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

st: RE: A problem with egen??

From   "Nick Cox" <>
To   <>
Subject   st: RE: A problem with egen??
Date   Wed, 4 May 2005 00:18:57 +0100

I can't identify an -egen- function -pct()-. 

I can't reproduce this with -pctile()-. 

The internal code of -pctile()- doesn't 
handle p(50) differently from p(5). 

Please confirm exactly what you typed. 

I have to guess your result is some quirk of your data, 
on this information. 


heisnam singh a.k.a. Thoihen

>  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.

*   For searches and help try:

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