Thanks to Kit Baum, the -egenmore- package on SSC has been
updated. -egenmore- is a collection of more -egen- functions. The
collection consists of egen-functions from various authors, and an
integrative help-file maintained by Nick Cox.
The update consists of a single new function, -xtile()-, written by myself.
-xtile()- basically mirrors the functionality of the official Stata-command
-xtile-, but it is byable. That is, -xtile()- creates a new variable that
categorizes a variable by its quantiles. With "by", the -xtile()- makes the
categorization for each by-group separately.
-xtile()- is especially useful for data from cross-country comparative
surveys.
Syntax
------
egen newvar = xtile(varname), percentiles(numlist) by(varname) altdef weights
By default varname is dichotomized at the median. percentiles() requests
percentiles corresponding to numlist: for example, p(25(25)75) is used to
create a variable according to quartiles. weights() requests weighted
calculation of percentiles. altdef uses an alternative formula for
calculating percentiles. by() requests calculation by groups. You may also
use the by: construct. (Stata 8.2 required.)
Example
-------
. egen inc10 = xtile(income), by(country) p(10(10)90)
categorizes the variable income into 10 groups, one for each within country
decile. Observations with 1 on inc10 therefore fall in the poorest
income-decile of _their_ country.
Installation
------------
. ssc install egenmore, replace
For help on -xtile()- and the other egen-functions of -egenmore- see
. help egenmore
Annotation
----------
Thanks to Nick Cox for including -xtile()- in -egenmore-
uli
--
[email protected]
+49 (030) 25491-361
*
* 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/