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

st: A problem with egen??


From   heisnam singh <thoihen@yahoo.com>
To   statalist@hsphsun2.harvard.edu
Subject   st: A problem with egen??
Date   Tue, 3 May 2005 16:05:20 -0700 (PDT)

Dear Statalist users,
 I am having a problem in using the egen command.My
dataset has many countries. I want to generate a
variable which takes value= 5th (or  any) percentile
value of another variable for each country.  I  tried
this :

sort country   
by country:egen X_5pct=pct(X), p(5)

I am getting the same value for all the countries,
which  is the 5th percentile value of the entire
sample. Whereas I want the 5th percentile value for
each country separately.

However if I do without specifying the option p(5)

sort country   
by country:egen X_5pct=pct(X)

Then I get the median (50th percentile value) for each
country separately. But whenever I tried with the
option p(5), I get the value for the entire sample.

Please help me out. 

Thoihen

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 
*
*   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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index