Although my suggestion was centered around -egen-, which is very often a
convenience, you can usually do things more efficiently. For example, in
this case, -_pctile if . . ., percentiles(75)- and then -replace p75 = r()
in . . . - would avoid redundancy of -by . . .: egen . . . pctile()- where
all of the other groups' results are calculated and discarded each time.
There are other ways to polish the suggestion, too, and difference would be
noticeable with large datasets and many groups.
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/