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

st: RE: RE: Labeling values of variables

From   "Nick Cox" <>
To   <>
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 


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
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 *
the labels automatically become "relation==1 & sex==1", "relation==2 &
sex==1". How do I obtain labels which say "married male" and "divorced

*   For searches and help try:

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