Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


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

Re: st: stored information for each regression equation--help please


From   Ken Ning <[email protected]>
To   [email protected]
Subject   Re: st: stored information for each regression equation--help please
Date   Mon, 19 Aug 2013 18:57:03 +0100

Thank you. this is very helpful.

On 15 August 2013 23:24, Phil Schumm <[email protected]> wrote:
> On Aug 15, 2013, at 5:04 PM, Ken Ning <[email protected]> wrote:
>> I am wondering if you know how to ask stata to gen a variable that takes the value of stored information for each regression equation, as it seems that the stored information is only for the last equation?
>>
>> e.g.
>>
>> sysuse auto
>> by foreign: reg price mpg rep78
>> by foreign: gen b=e(r2) (this does not work--could you please help?)
>
>
> You want
>
>     statsby b=e(r2), by(foreign): reg price mpg rep78
>
> or, if you want to retain the original data in memory, something like
>
>     tempfile foo
>     statsby b=e(r2), by(foreign) saving(`"`foo'"'): reg price mpg rep78
>     merge m:1 foreign using `"`foo'"', nogen
>
>
> -- Phil
>
>
> *
> *   For searches and help try:
> *   http://www.stata.com/help.cgi?search
> *   http://www.stata.com/support/faqs/resources/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/faqs/resources/statalist-faq/
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index