I'm working on country wise regressions and using different codes on forum ran the following:
Code:
levelsof cty, local(country)
local file E:\2014V7.xls
foreach c of local country{
capture reg dv l.dv var1 var2 var3 var4 var5 var6 var7 var8 var9 if cty ==`c'
if c(rc) == 0 {
outreg2 using "`file'", append bdec(3) tdec(3) rdec(3) pdec(3) stats(coef se) ctitle("dv" `e(model)'`c') title("OLS by Country") addstat("F-Stat",e(F),"Prob > F",e(p))
}
else if !inlist(2000, 2001){
display as error "Unexpected error with cty == `c'"
}
}Thank you.
Best regards,
Shabeen
0 Response to Foreach regression by group, Outreg2 error 'Invalid syntax'
Post a Comment