Hi! I am new to this Community, this is my first post. I am trying to create some coefplots with stata using regressions (I am using reghdfestd version 5 so it works) and after this code I find: "__000001- invalid name r(198);
end of do-file r(198); ". I do not have a variable called like that and I am not trying to name one like that. What is the reason for the error?
"gl y_ivs meancact indextab trust_out gl y_gps negrecip
gl fe1ivs ${febaseivs} yearb country year age gl fe1gps ${febasegps} yearb country year age
gl g1 "0 5" gl g2 "6 17" gl g3 "18 25" gl g4 "26 32" gl g5 "33 40" gl g6 "41 50" gl g7 "51 60" gl g8 "61 70" gl g9 "71 200"
u "temp",replace foreach b in ivs gps{ u "temp/b'",replace mer m:1 country year yearb using "temp/2democracy/tot/demAge",keepus(dem1* dem2*) keep(1 3) nogen foreach y in ${y_b'}{
local w = 0 matrix coef = J(9, 3, .) matrix coln coef = coefficients1 lcl1 ucl1 //para guardar coeficiente lowe bound y upper bound matrix rown coef = "Epidemic exposure (0-5)" "Epidemic exposure (6-17)" "Epidemic exposure (18-25)" "Epidemic exposure (26-32)" "Epidemic exposure (33-40)" "Epidemic exposure (41-50)" "Epidemic exposure (51-60)" "Epidemic exposure (61-70)" "Epidemic exposure +71" forv g=1/9 { loc w = `w'+1 loc min=real(word("${g`g'}",1)) loc max=real(word("${g`g'}",2)) preserve drop if !inrange(year-yearb,`min',`max') reghdfestd `y' dem1g`g' if inrange(year-yearb,`min',`max'), a(${fe1`b'}) cl(${cl1}) version(5) mat os = r(table) mat coef[`w',1] = os[1,1] mat coef[`w',2] = os[5,1] mat coef[`w',3] = os[6,1] restore } coefplot (matrix(coef[,1]), ci((coef[,2] coef[,3]))), title("Effect of Exposure to Sickness on `y'",size(medsmall)) graphregion(color(white)) bgcolor(white) horizontal yline(1 2 3 4 5 6 7 8 9, lpattern(shortdash) lcolor(gray)) /// xline(0) ciopts(lwidth(vthick) lcolor(emidblue)) grid(between glpattern(shortdash)) msymbol(O) mfcolor(white) mlabel mlabposition(6) ylabel(,labs(vsmall)) gr export "${savef}/ages`y'.pdf",replace }
}".
end of do-file r(198); ". I do not have a variable called like that and I am not trying to name one like that. What is the reason for the error?
"gl y_ivs meancact indextab trust_out gl y_gps negrecip
gl fe1ivs ${febaseivs} yearb country year age gl fe1gps ${febasegps} yearb country year age
gl g1 "0 5" gl g2 "6 17" gl g3 "18 25" gl g4 "26 32" gl g5 "33 40" gl g6 "41 50" gl g7 "51 60" gl g8 "61 70" gl g9 "71 200"
u "temp",replace foreach b in ivs gps{ u "temp/b'",replace mer m:1 country year yearb using "temp/2democracy/tot/demAge",keepus(dem1* dem2*) keep(1 3) nogen foreach y in ${y_b'}{
local w = 0 matrix coef = J(9, 3, .) matrix coln coef = coefficients1 lcl1 ucl1 //para guardar coeficiente lowe bound y upper bound matrix rown coef = "Epidemic exposure (0-5)" "Epidemic exposure (6-17)" "Epidemic exposure (18-25)" "Epidemic exposure (26-32)" "Epidemic exposure (33-40)" "Epidemic exposure (41-50)" "Epidemic exposure (51-60)" "Epidemic exposure (61-70)" "Epidemic exposure +71" forv g=1/9 { loc w = `w'+1 loc min=real(word("${g`g'}",1)) loc max=real(word("${g`g'}",2)) preserve drop if !inrange(year-yearb,`min',`max') reghdfestd `y' dem1g`g' if inrange(year-yearb,`min',`max'), a(${fe1`b'}) cl(${cl1}) version(5) mat os = r(table) mat coef[`w',1] = os[1,1] mat coef[`w',2] = os[5,1] mat coef[`w',3] = os[6,1] restore } coefplot (matrix(coef[,1]), ci((coef[,2] coef[,3]))), title("Effect of Exposure to Sickness on `y'",size(medsmall)) graphregion(color(white)) bgcolor(white) horizontal yline(1 2 3 4 5 6 7 8 9, lpattern(shortdash) lcolor(gray)) /// xline(0) ciopts(lwidth(vthick) lcolor(emidblue)) grid(between glpattern(shortdash)) msymbol(O) mfcolor(white) mlabel mlabposition(6) ylabel(,labs(vsmall)) gr export "${savef}/ages`y'.pdf",replace }
}".
Comment