- ----------------------- copy starting from the next line -----------------------
- [CODE]
- * Example generated by -dataex-. To install: ssc install dataex
- clear
- input float(code nature1 nature6 nature7 nature8 nature9 nature10)
- 1 1 6 7 8 9 0
- 2 2 6 4 7 5 2
- 3 6 8 6 3 2 1
- 4 2 3 2 1 4 5
- 5 1 4 7 8 9 6
- 6 1 8 9 6 3 0
- 7 2 5 4 1 3 2
- 8 0 4 5 6 3 2
- 9 1 8 9 6 3 0
- 10 2 5 4 1 3 2
- 11 0 4 5 6 3 2
- 12 2 5 4 1 3 2
- end
------------------ copy up to and including the previous line -----------------
[/code]数据如上,请问:我如何新增一个变量实现分类汇总,比方说000001这只股票后十个观测值有一个1 所以我想生成一个变量count1=1;再比方说000002后面十个观测值中有两个2,所以count1=0,再生成一个变量count2=2
感谢