Statalist


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

Re: st: Naming estimates from -eststo- and -bysort-


From   Ben Jann <ben.jann@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: Naming estimates from -eststo- and -bysort-
Date   Wed, 14 Oct 2009 09:35:04 +0200

You can select estimates to be tabulated using the * and ? wildcards.
For example, type

eststo clear
sysuse auto, clear
eststo regression: reg price weight mpg
quietly bysort foreign: eststo: estpost summarize price weight mpg
esttab est*, label nodepvar cells( mean(fmt(2)) sd(par fmt(2)) )

If you don't like the "est" prefix, you can change it using the
-prefix()- option in -eststo-. Example:

eststo clear
sysuse auto, clear
eststo regression: reg price weight mpg
quietly bysort foreign: eststo, prefix(descr): estpost summarize price
weight mpg
esttab descr*, label nodepvar cells( mean(fmt(2)) sd(par fmt(2)) )

ben

On Wed, Oct 14, 2009 at 4:07 AM, Bert Jung <bjung59@gmail.com> wrote:
> Dear Statalisters,
>
> I am using the ever helpful -estpost- with -bysort- to post summary
> statistics for subgroups.  I need to give specific names the stored
> estimates in this setup so that I can output them later.  In the below
> examples there is already a stored estimates (named "regression") that
> I want to keep for later use.  Before that I want to output the
> summary statistics by themselves.
>
> If I specify a name for the stored estimates (first attempt below)
> only the summary statistics for the last subgroup are saved.  But I
> want all subgroups.
>
> If I don't specify a name -estpost- will assign one with stub "est"
> and numbers that depend on how many previous estimates are already
> stored (in my case the names are est2 and est3, see second attempt
> below).  So one solution is to use $eststo_counter to get the last two
> estimates for the two subgroups.  But I wonder if there is a more
> direct way?
>
> Thanks,
> Bert
>
>
> *** First attempt, with name ***
> eststo clear
> sysuse auto, clear
>
> eststo regression: reg price weight mpg
>
> quietly bysort foreign: eststo summarystats: estpost summarize price weight mpg
>
> * This outputs all stored estimates but only want summary statistics
> esttab, label nodepvar cells( mean(fmt(2)) sd(par fmt(2)) )
>
> * Stored estimates called "summarystats" but only the last -by- group
> is available
> eststo dir
>
>
> *** Second attempt, without name ***
> eststo clear
> sysuse auto, clear
>
> eststo regression: reg price weight mpg
>
> quietly bysort foreign: eststo: estpost summarize price weight mpg
>
> * This outputs all stored estimates but only want summary statistics
> esttab, label nodepvar cells( mean(fmt(2)) sd(par fmt(2)) )
>
> * Stored estimates are called est2, est3
> eststo dir
> *
> *   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   |   What's new   |   Site index