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 on April 23, and its replacement, statalist.org is already up and running.


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

Re: Re: st: Tabulate summary statistics by percentiles and save output


From   annoporci <annoporci@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   Re: Re: st: Tabulate summary statistics by percentiles and save output
Date   Sat, 29 Dec 2012 07:03:05 +0800

Nick wrote:
One problem here is where you think Stata is looking for saved results such as r(p1). Either non-missing values are accessible because they were left behind by some _previous_ command; or Stata will use missing values, which in your case will result in lack of restriction on the observations used. It's not an error to refer to saved results that don't exist.


I get it!

So either I need to add summarize,detail before every new computation dependent upon r(pi) (i=1,2,...) or I need to save these values. I'm guessing the latter is more efficient, so I'll probably do that eventually. In the meantime, I confirm that the following seems to produce the correct results:

foreach var of varlist `variables' {
   quietly summarize `var', detail
quietly estpost summarize `var' if inrange(`var',`=r(p1)',`=r(p10)'), detail esttab using moments`var'.tex, replace cells("count mean sd skewness kurtosis") noobs nodis nonumbers nonotes
   quietly summarize `var', detail
quietly estpost summarize `var' if inrange(`var',`=r(p90)',`=r(p100)'), detail esttab using moments`var'.tex, append cells("count mean sd skewness kurtosis") noobs nodis nonumbers nonotes
 }

Thanks Nick.


Nick wrote:
You refer here to several user-written commands but in no case do you explain where they come from.


Well, I googled "stata export table latex" and quickly gathered a few of them. I'm not sure which one is the most appropriate for my problem, can you recommend one?

Thanks,

--
Patrick Toche.
*
*   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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index