- * Example generated by -dataex-. To install: ssc install dataex
- clear
- input float(stkcd time)
- 2002 .
- 2002 0
- 2002 .
- 2002 .
- 2002 .
- 2002 .
- 2002 .
- 2002 .
- 2002 .
- 2002 .
- 2004 .
- 2004 .
- 2004 .
- 2004 .
- 2004 .
- 2004 .
- 2004 0
- 2004 .
- 2004 .
- 2004 .
- 2006 .
- 2006 .
- 2006 .
- 2006 .
- 2006 .
- 2006 .
- 2006 .
- 2006 .
- 2006 0
- 2006 .
- end
------------------ copy up to and including the previous line ------------------
如上面的数据所显示的,我想以每个不同的sktcd为一组,然后根据每组的唯一非缺失值生成序号,目标数据为:
- * Example generated by -dataex-. To install: ssc install dataex
- clear
- input float(stkcd time)
- 2002 -1
- 2002 0
- 2002 1
- 2002 2
- 2002 3
- 2002 4
- 2002 5
- 2002 6
- 2002 7
- 2002 8
- 2004 -6
- 2004 -5
- 2004 -4
- 2004 -3
- 2004 -2
- 2004 -1
- 2004 0
- 2004 1
- 2004 2
- 2004 3
- 2006 -8
- 2006 -7
- 2006 -6
- 2006 -5
- 2006 -4
- 2006 -3
- 2006 -2
- 2006 -1
- 2006 0
- 2006 1
- end
------------------ copy up to and including the previous line ------------------
接下来当然还有很多股票代码,但篇幅原因就截取了这一小段了。不知道坛友有没有什么好办法呢,我想过一段时间,可能需要bysort命令,但苦思冥想还是没有办法,望坛友解答!!!


雷达卡






京公网安备 11010802022788号







