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

st: updates to -egenmore- on SSC


From   "Nick Cox" <n.j.cox@durham.ac.uk>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: updates to -egenmore- on SSC
Date   Fri, 12 Mar 2004 09:39:13 -0000

Thanks to Kit Baum, various updates 
have been made to -egenmore- on SSC. 

-egenmore- is a ragbag of about 55 extra 
-egen- functions by various hands. 

To install or replace, use the -ssc- command. 

new function: -axis()- (requires Stata 8)
=========================================

axis(varlist) [ , gap label(lblvarlist) missing reverse ] resembles egen's 
group(varlist), but is specifically designed for constructing 
categorical axis variables for graphs, hence the name. It creates a single 
variable taking on values 1, 2, ... for the groups formed by varlist.  
varlist may contain string, numeric, or both string and numeric 
variables.  The order of the groups is that of the sort order of varlist.
gap overrides the default numbering of 1 up by adding a gap of 1 
whenever a variable changes. label(lblvarlist) specifies that labels 
are to be assigned based on the value labels or values of lblvarlist; 
if not specified lblvarlist defaults to varlist. missing indicates 
that missing values in varlist (either . or "") are to be treated like 
any other value when assigning groups, instead of missing values being 
assigned to the group missing. reverse reverses labelling so that 
groups that would have been assigned values of 1 ... whatever are 
instead assigned values of whatever ... 1. 

-axis()- was explained in a posting on 18 February. It is also 
used by -tabplot- and -tableplot- on SSC. 

new function: -density()- (requires Stata 8)
============================================

density(varname) [ , width(#) start(#) frequency percent fraction
by(byvarlist) ] calculates the density (or optionally the frequency, 
fraction or percent) of values in bins of width width() (default 1) 
starting at start() (default minimum of the data). Note that each value 
produced will be identical for all observations in the same bin. Commonly 
for further use it will be desired to select one value from each bin, say 
by using egen's tag() function. 

Clearly, this is (close to) what -histogram- does before it does
its graphics. Occasionally, having the numbers for some other purpose
is useful.

revised function: -ncyear()- (requires Stata 6) 
=============================================== 

ncyear(datevar) , month(#) [ day(#) ] returns an integer 
variable labelled with labels such as "1952/53" for non-calendar 
years starting on the specified month and day (day defaults to 1). 
datevar is treated as indicating elapsed dates. 

Richard Williams kindly pointed out a labelling problem consequent
on a change in -egen-'s behaviour in Stata 8. It should now 
work properly in Stata 6, 7 and 8. 

Nick 
n.j.cox@durham.ac.uk 

*
*   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/



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