Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: Generating percentiles


From   Mario Macis <[email protected]>
To   [email protected]
Subject   Re: st: Generating percentiles
Date   Sat, 16 Jul 2005 18:39:53 -0500

Hi,
say you want the 25th percentile:

sort year
by year: egen p25 = pctile(price), p(25)

Hope this helps!

Mario


On 7/16/05, Yvonne Capstick <[email protected]> wrote:
> 
> Hi,
> 
> I am able to generate easily the median of a variable for a given year, e.g.
> 
> sort year
> by year: egen medianprice = median(price)
> 
> Does anyone know how I can generate the 30th and 70th percentile of a
> variable? I know I can use the centile function to display the 30th and 70th
> percentiles, and the centile function can definitely be used with "by", but
> it can't be used with "egen" it seems.
> 
> Thanks
> Yvonne
> 
> _________________________________________________________________
> On the road to retirement? Check out MSN Life Events for advice on how to
> get there! http://lifeevents.msn.com/category.aspx?cid=Retirement
> 
> *
> *   For searches and help try:
> *   http://www.stata.com/support/faqs/res/findit.html
> *   http://www.stata.com/support/statalist/faq
> *   http://www.ats.ucla.edu/stat/stata/
>

*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index