sungmoo 发表于 2010-1-9 19:32 
*用最末期配平面板?试一下
bys id: egen n=count(id)
expand 5-n if n==group
sort id time2 group
稍稍改动了一下:
clear all
input id time2 group
1 14 1
1 25 2
1 44 3
1 74 4
2 30 1
2 47 2
3 50 1
end
tempvar temp n
bys id: egen `n'=count(id)
expand 5-`n' if `n'==group
egen `temp'=fill(1/4 1/4)
replace group=`temp'
sort id time2 group