如:原本股票代码:000002000002000006000006000007导入stata后转化为数值型,现在是:22667怎样改成:11223
用egen命令
sort code // 对股票代码进行排序 egen id = group(code) // 将股票代码转化为从1开始的序列