我用
forvalue i=1/390 {
reg y x if g=="i"
predict xb1 if g=="i"
predict res1 if g=="i",res
replace xb=xb1 if g=="i"
replace res=res1 if g=="i"
drop xb1 res1 }
出现了“type mismatch”,
我尝试着分别当i=1时,可以得出结果的,
forvalue i=1/390 {
reg y x if g=="i"
predict xb1 if g=="i"
predict res1 if g=="i",res
replace xb=xb1 if g=="i"
replace res=res1 if g=="i"
drop xb1 res1
}
forvalue i=1/390 {
reg y x if g==`i'
predict xb1 if g==`i'
predict res1 if g==`i',res
replace xb=xb1 if g==`i'
replace res=res1 if g==`i'
drop xb1 res1
}