Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: egenmore updated on SSC

From   Ulrich Kohler <[email protected]>
To   [email protected]
Subject   st: egenmore updated on SSC
Date   Fri, 7 Jan 2005 09:32:35 +0100

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 


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.) 


. 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. 


. ssc install egenmore, replace    

For help on -xtile()- and the other egen-functions of -egenmore- see 

. help egenmore


Thanks to Nick Cox for including -xtile()- in -egenmore-


[email protected]
+49 (030) 25491-361

*   For searches and help try:

© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index