Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: RE: RE: Labeling values of variables


From   "Nick Cox" <n.j.cox@durham.ac.uk>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: RE: RE: Labeling values of variables
Date   Thu, 14 Feb 2008 16:01:14 -0000

See also -dummieslab- from SSC. 

Nick Cox

One answer is to form a composite by 

egen group = group(relation sex), label 

and then form your own dummies using -tabulate, gen()-. 
But that still leaves rather ugly looking variable labels. 
You could in turn fix those with -labvarch- from -labutil- from SSC. 

That is all getting rather complicated. Here is a quick hack to 
do it in one. Note that 

nicelylabelleddummies varname, gen(frog) 

will produce the dummies for varname 

while 

nicelylabelleddummies var1 var2, gen(toad) 

will produce the dummies for var1*var2, but it won't produce 
produce dummies for var1 and var2 separately. 

*! NJC 1.0.0 14 Feb 2008 
program nicelylabelleddummies
end 
	
Peter Dijkstra
==============

I like to have sensible value labels of variables, and use
   label define relation 0 "single" 1 "married" 2 "divorced"
   label define sex 0 "female" 1 "male"
in StataSE 8.2. However, when using
   xi i.relation * i.sex
the labels automatically become "relation==1 & sex==1", "relation==2 &
sex==1". How do I obtain labels which say "married male" and "divorced
male"?

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