Dear community,
I am trying to generate a cross-sectional regression for multiple industries and through time.
However, I can't seem to find a way to obtain a column with the constant of each regression and I only get the intercept of the last regression.
This is what I have so far:
foreach i of varlist Oil Util Telcm PerSv BusSv Hardw Chips LabEq Boxes Trans Whlsl Rtail Meals Banks Insur RlEst Fin Other {
eststo: reg `i' MktRF
display [#2]_b[_cons]
predict newvar`i', residuals
gen coefficient`i'=.
replace coefficient `i'= _b[_cons]
}
Stata keeps giving me the error that the second equation couldn't be found.
Does someone know what I am doing wrong??
I am trying to generate a cross-sectional regression for multiple industries and through time.
However, I can't seem to find a way to obtain a column with the constant of each regression and I only get the intercept of the last regression.
This is what I have so far:
foreach i of varlist Oil Util Telcm PerSv BusSv Hardw Chips LabEq Boxes Trans Whlsl Rtail Meals Banks Insur RlEst Fin Other {
eststo: reg `i' MktRF
display [#2]_b[_cons]
predict newvar`i', residuals
gen coefficient`i'=.
replace coefficient `i'= _b[_cons]
}
Stata keeps giving me the error that the second equation couldn't be found.
Does someone know what I am doing wrong??
Comment