I am starting with a list of variables that I would like to run regressions on. I would then like to save their coefficients as a scalar with a number on the end. For example, here is my code so far
local varlist="vertical reps"
foreach variable of local varlist{
forval i=1/2{
quietly reg successorfail `variable'
scalar s`i'=_b[`variable']
}
}
When I list the results of this I just get:
s2 = .00928925
s1 = .00928925
So it is creating new scalars with just the last regression coefficient it ran.
I would like the result to be:
s1=first reg coefficient
s2=2nd reg coefficient
Thanks!