www11122 发表于 2020-1-6 16:57 
黄老师求助!使用tsfill, full时,出现
timevar (yr) may not contain missing values when option full ...
cd C:\Users\redst\Desktop\11
import excel using 机构设立情况.xlsx, first clear
labone,nrow(1)
drop in 1
split Inscity, parse("-")
replace Inscity2=Inscity1 if Inscity2==""
egen code=group(Inscode)
gen yr=real(substr( Issdate,1,4))
tsset code yr
tsfill, full
bysort code (yr): carryforward Inscode-Inscity2 , replace
drop if Inscode==""
order code yr
preserve