st: How to calculate 75 percentile of other individuals on the samegroup

st: How to calculate 75 percentile of other individuals on the samegroup

Date

Sat, 29 Sep 2007 14:57:11 -0700

Quang Nguyen wrote:
A simplified version of my data looks as follows:
ID Group X
1 a 5
2 a 7
3 a 9
4 a 8
5 b 3
6 b 4
7 b 9
..........................
I would like to generate a new variable whose value is the 75 percentile of
other individuals in the same group as the concerned individual. For
example, for the first individual (ID=1), this will be: 75 percentile
of {7, 9, 8}.
I would highly appreciate if someone could suggest me a solution for this.
--------------------------------------------------------------------------------
-findit percentile- turns up a lot to pore over. But among the results
is -egen <varname> = pctile(exp), p(#)-, which can take a -by- varlist.
Try something like:
bysort Group: egen p75 = pctile(X), p(75)
Joseph Coveney
*
* 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/