Paul Visintainer wrote:
Is there a way to create a new variable that uses cutpoints based on
unique percentiles of distribution? For example, suppose I want a new
variable with 4 groups at (or as close as the distribution will allow)
the following percentile cutpoints: 13th percentile, 35th percentile,
and the 73rd percentile? I've looked at -xtile-, -pctile-, and -egen-
and they don't seem to allow for this option.
--------------------------------------------------------------------
The -egenmore- -xtile()- function does it. You may need first to
ssc install egenmore
. sysuse auto , clear
. egen pricegrp = xtile(price) , percentiles(13 35 73)
. tab1 pricegrp
-> tabulation of pricegrp
pricegrp | Freq. Percent Cum.
------------+-----------------------------------
1 | 10 13.51 13.51
2 | 16 21.62 35.14
3 | 29 39.19 74.32
4 | 19 25.68 100.00
------------+-----------------------------------
Total | 74 100.00
Hope this helps
Svend
________________________________________________________
Svend Juul
Institut for Folkesundhed, Afdeling for Epidemiologi
(Institute of Public Health, Department of Epidemiology)
Vennelyst Boulevard 6
DK-8000 Aarhus C, Denmark
Phone, work: +45 8942 6090
Phone, home: +45 8693 7796
Fax: +45 8613 1580
E-mail: [email protected]
_________________________________________________________
*
* 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/