南宫姑娘 发表于 2017-5-9 18:10 
新手同问
这是我用的方法,供参考!
findit egenmore
bys year nfid: egen type = nvals(tradecode)
gen style=tradecode if type==1
replace style=0 if type!=1
gen mixed=1 if style==0
replace mixed=0 if style!=0
gen pure_general=1 if style==1
replace pure_general=0 if style!=1
gen pure_process=1 if style==2
replace pure_process=0 if style!=2