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/