- * Example generated by -dataex-. To install: ssc install dataex
- clear
- input int year byte(id impexp) float newimp
- 2000 1 1 1
- 2000 1 1 1
- 2000 1 1 1
- 2000 1 1 1
- 2000 1 1 1
- 2000 1 1 1
- 2000 2 1 3
- 2000 2 1 3
- 2000 2 0 3
- 2000 2 1 3
- 2000 3 0 0
- 2000 3 0 0
- 2000 3 0 0
- 2000 3 0 0
- 2000 3 0 0
- end
- sort id
- by id : egen numid=count(impexp)
- by id : egen numimp1=count(impexp) if impexp==1
- by id : egen numimp2=count(impexp) if impexp==0
- replace numimp1=0 if numimp1==.
- replace numimp2=0 if numimp2==.
- gen numimp=numimp1+numimp2
- gen newimp=.
- replace newimp=1 if impexp==1
- replace newimp=0 if impexp==0
- replace newimp=3 if numimp!=numid
- drop numid numimp1 numimp2 numimp


雷达卡







京公网安备 11010802022788号







