Hello all,

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'"
    }
}
The code runs fine and gives output for 27 countries (with a few "unexpected error " messages for countries with missing control variables). However, after that it gives error " Invalid syntax r(198)": Could someone please help me with this.

Thank you.

Best regards,
Shabeen