黃河泉 发表于 2017-9-28 17:14 
试试
您好,再次求您帮助,数据格式转换,想把现在的id变量设为变量名,max转换成变量id1-id9的数据。
当前格式如下:
----------------------- copy starting from the next line -----------------------
* Example generated by -dataex-. To install: ssc install dataex
clear
input long Symbol float(year id max)
1 2008 3 1
1 2008 5 3
1 2008 6 1
1 2008 7 2
1 2009 6 6
1 2009 7 4
1 2010 1 7
1 2010 3 8
1 2010 5 23
1 2010 6 18
1 2010 7 9
1 2010 9 3
1 2011 1 10
1 2011 3 14
1 2011 5 15
end
复制代码
------------------ copy up to and including the previous line ------------------
希望变成:
Symbol year id1 id2 id3 id4 id5 id6 id7 id8 id9
1 2008 . . 1 . 3 1 2 . .
1 2009 . . . . . 6 4 . .
1 2010 7 . 8 . 23 18 9 . 3
1 2011 10 . 14 . 15 . . . .