Dear Stata community,
when I want to access a coefficient value after running a regression, one way to do that is by first storing the coefficient vector and then accessing the specific coefficient of interest as follows:
I've recently come accross a code which shortcuts this same procedure by directly accessing the specific value of the e(b) vector without using "matrix define" as in the following:
When I try to run the code, it doesn't work, i receive an "invalid syntax" error. However, the code I came accross uses this technique so frequently that I doubt that it is simply a mistake. Is there anything in the Stata settings I can change to make the code "legal" or does it only work for a specifc Stata version? I'm using Stata 15.
Thank you
when I want to access a coefficient value after running a regression, one way to do that is by first storing the coefficient vector and then accessing the specific coefficient of interest as follows:
Code:
clear sysuse auto reg mpg foreign matrix define coeff = e(b) local b1 = coeff[1,2]
Code:
clear sysuse auto reg mpg foreign local b1 = e(b)[1,2]
Thank you
Comment