Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down at the end of May, and its replacement, statalist.org is already up and running.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: st: OLS: How to save constants as a new variable?


From   Alan Neustadtl <alan.neustadtl@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: OLS: How to save constants as a new variable?
Date   Sun, 22 May 2011 10:04:23 -0400

You can store any coefficient from your last estimated model in a
local macro and use it later in the same program.  The following shows
some ways to access the coefficients.

Best,
Alan
/***********/
sysuse auto, clear
reg mpg c.weight##c.weight
di _b[_cons]
di _b[weight]
di _b[c.weight#c.weight]

local constant _b[_cons]
di `constant'
/***********/

On Sat, May 21, 2011 at 11:28 AM, Barbara Engels <engels.ba@gmail.com> wrote:
> I made some regressions and want to save the constants of the different regressions in the form of a new variable so that I can make further calculations with the vector of the constants. how can I do that?
> *
> *   For searches and help try:
> *   http://www.stata.com/help.cgi?search
> *   http://www.stata.com/support/statalist/faq
> *   http://www.ats.ucla.edu/stat/stata/
>

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index