全部版块 我的主页
论坛 计量经济学与统计论坛 五区 计量经济学与统计软件 Stata专版
1296 2
2020-06-28

问题:

比如,0101101010这个code,它的xinst xinend分别是2005和2007,如何分别写成三行呢,写成0101101010在2005,2006,2007各有一行记录呢?

. dataex code xinst xinend in 1/10

----------------------- copy starting from the next line -----------------------
复制代码

------------------ copy up to and including the previous line ------------------


二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

全部回复
2020-6-30 11:25:27
gen id=_n
order id
expand 2
sort id
replace xinst=xinend if mod(_n,2)==0
duplicates drop id xinst,force
destring xinst,replace
xtset id xinst
tsfill
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

2020-6-30 12:37:54
songking 发表于 2020-6-30 11:25
gen id=_n
order id
expand 2
非常非常感谢
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

相关推荐
栏目导航
热门文章
推荐文章

说点什么

分享

扫码加好友,拉您进群
各岗位、行业、专业交流群