Save Estimation Results with dataset for future retrieval
estsave [, gen(newvarname) from(varname) label(labeltext) replace]
Description
estsave saves and retrieves estimation results with the current dataset, allowing retrieval of estimation results across sessions. For storing and retrieving estimation results within a single Stata session, see estimates.
estsave creates a new variable that identifies the estimation sample and stores all estimation-related scalars, macros, and matrices using characteristics associated with that variable. Dropping the variable drops the estimation results.
Options
gen(newvarname) is required for saving estimation results. estsave will generate this new byte variable to mirror the contents of e(sample) from the last estimation. The variable will have characteristics associated with it that contain all of the estimation results. Users may wish to choose a name that allows easy identification of estsave variables, for example using a consistent prefix such as es_.
from(varname) specifies the name of the variable for retrieving estimation results previously saved by estsave.
label(labeltext) is a convenience feature that adds to the variable label of the newly created variable. estsave labels the new variable as "estsave results: cmdname depvarname" followed by the text specified in label.
replace allows estsave to overwrite an existing variable.
Examples
. regress mpg weight . estsave , gen(es_reg1) label(mpg v weight all obs) . save mydata
in the same or a future Stata session:
. estsave , from(es_reg1) retrieves results
you can now use post-estimation commands
. test _b[weight]=.002
Technical Note
Because of certain features within the Stata executable, estimation results retrieved using estsave may not be able to re-play the full output of some internal (vs. .ado) commands. Still, the basic coefficient table will re-display and post-estimation commands such as test and predict will work. One exception is that predict commands with -rules- options will not honor the rules.
Author
Michael Blasnik (M. Blasnik & Associates, Boston, MA) Email: michael.blasnik@verizon.net
Also see