执行命令后显示invalid syntax,请问是什么问题呀?具体命令如下:
gen roa_t0 =.
gen IND_t0 = .
gen size_t0 =.
gen yr_t0 =.
gen id_t0 =.
foreach i=1/227{
replace roa_t0 = roa[`i’]
replace IND_t0 = IND[`i’]
replace size_t0 = size[`i’]
replace yr_t0 = year[`i’]
replace id_t0 = id[`i’]
replace ratio_roa = roa/roa_t0 if year==yr_t0 & IND==IND_t0 & yesT==0
count if ratio_roa>0.8 & ratio_roa<1.2 & year==yr_t0 & IND==IND_t0
replace n_match = r(N) if nn==1
if r(N)>1{
replace ratio_size = abs(size/size_t0-1) if ratio_roa>0.8 & ratio_roa<1.2 & year==yr_t0 & yesT==0 & IND==IND_t0
sum ratio_size if ratio_roa>0.8 & ratio_roa<1.2 & year==yr_t0 & yesT==0 & IND==IND_t0
replace Control=1 if ratio_size==r(min) & year==yr_t0 & Control!=1
replace match_id=id_t0 if ratio_size==r(min) & year==yr_t0
}
if r(N)<2{
replace Control=1 if ratio_roa>0.8 & ratio_roa<1.2 & year==yr_t0 & IND==IND_t0 & Control!=1
replace match_id=id_t0 if ratio_roa>0.8 & ratio_roa<1.2 & year==yr_t0 & IND==IND_t0
}
}