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: st: how to save the result of percentile using summarize


From   Philipp Rehm <philipp.rehm@gmx.de>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: how to save the result of percentile using summarize
Date   Sat, 20 Feb 2010 22:39:07 -0500

.
Your example syntax doesn't really work - and you display information from the helpfile that suggests so.

Consider this example:
sysuse auto, clear
su price,detail
di "** `r(p66)' **"
list if price>r(p66)

What you posted under "stata help copy" suggests that r(p66) is not defined (-sum, detail- returns r(p75) and r(p90), but no other percentile between these two). A quick way to find out would be:

sum price,detail
ereturn list

To access p66, you have several options, including the following two:

(1)
_pctile price, p(66)
ret li
di "*** `r(r1)' ***"

(2)
egen p66 = pctile(price), p(66)

Type "help pctile" for more info.

HTH,
Philipp



On 2/20/2010 10:22 PM, Nobuya Fukugawa wrote:
statalisters,
is it possible to save the result of percentile other than listed
below (e.g. 66th percentile) using "summarize"?
------example-------
su y,detail
list if y>r(p66)

------stata help copy-------
Saved results

    summarize saves the following in r():

    Scalars
      r(N)           number of observations
      r(mean)        mean
      r(skewness)    skewness (detail only)
      r(min)         minimum
      r(max)         maximum
      r(sum_w)       sum of the weights
      r(p1)          1st percentile (detail only)
      r(p5)          5th percentile (detail only)
      r(p10)         10th percentile (detail only)
      r(p25)         25th percentile (detail only)
      r(p50)         50th percentile (detail only)
      r(p75)         75th percentile (detail only)
      r(p90)         90th percentile (detail only)
      r(p95)         95th percentile (detail only)
      r(p99)         99th percentile (detail only)
      r(Var)         variance
      r(kurtosis)    kurtosis (detail only)
      r(sum)         sum of variable
      r(sd)          standard deviation

thank you in advance.
*
*   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