Hi everyone,
Kindly help me on how I can define the content of the scalar variable i.e. "sca b_ `x' " after estimating a regression. I have provided the codes that I am running using the "sysuse auto" data set to illustrate what I am trying to do.
sysuse auto
global X " mpg weight i.rep78"
reg price $X
foreach x of global X {
sca b_`x' = _b[`x']
}
When I run the codes, stata(15) gives me this error " b_i.rep78 invalid name" . If also tried " sca b_ `x' = _b[`x' , 2.`x' .. 5. `x' ] still does not work.
Kindly help me on how I can define the content of the scalar variable i.e. "sca b_ `x' " after estimating a regression. I have provided the codes that I am running using the "sysuse auto" data set to illustrate what I am trying to do.
sysuse auto
global X " mpg weight i.rep78"
reg price $X
foreach x of global X {
sca b_`x' = _b[`x']
}
When I run the codes, stata(15) gives me this error " b_i.rep78 invalid name" . If also tried " sca b_ `x' = _b[`x' , 2.`x' .. 5. `x' ] still does not work.
Comment