Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down on April 23, and its replacement, statalist.org is already up and running.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: st: upper quartile selection for multiple groups


From   Maarten Buis <maartenlbuis@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: upper quartile selection for multiple groups
Date   Wed, 12 Jun 2013 15:31:14 +0200

On Wed, Jun 12, 2013 at 3:18 PM, Maria Sokolova wrote:
> I have big (very big) panel data, for which I need to create dummies
> representing the belonging to the top 5% (or 10%) per each categorie.
> I have too high number of categories (over 1000) to do it manually.

*------------------ begin example ------------------
sysuse nlsw88, clear
bys race : egen p80 = pctile(wage), p(80)
gen highwage = wage > p80 if wage < .
tab race highwage, row
*------------------- end example -------------------
(For more on examples I sent to the Statalist see:
http://www.maartenbuis.nl/example_faq )

Hope this helps,
Maarten

---------------------------------
Maarten L. Buis
WZB
Reichpietschufer 50
10785 Berlin
Germany

http://www.maartenbuis.nl
---------------------------------
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/faqs/resources/statalist-faq/
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index