Hi,
My model is as follows:

Code:
 bysort Z: reg y x i.(W)
where Z is a categorical variable and W is a vector of categorical variables (including w1, w2, w3, etc). I want to store the estimated coefficients, ste's, pvalues, and lower and upper confidence intervals into a matrix. I'm using the following codes:

Code:
return list
matrix list r(table)
mat resultsmat = r(table)
mat list resultsmat

local i=0
foreach j in z 0b.w1 {
local ++i
global beta_`j'=resultsmat[1,`i']
global ste_`j' = resultsmat[2,`i']
gl lc_i`j' = resultsmat[5,`i']
gl uci_`j' = resultsmat[6,`i']
global pval_`j'=resultsmat[4,`i']
}
However, I get the following error: 'beta_0b.w1 invalid name.'

I would appreciate any insights.

Thanks,