Statalist


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

st: RE: recode & set old label value


From   "Nick Cox" <n.j.cox@durham.ac.uk>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: RE: recode & set old label value
Date   Thu, 10 Jul 2008 11:30:41 +0100

-labmask- allows you to assign the values -- or optionally, and suitably
for your problem, the corresponding value labels  -- of one variable to
be the value labels of another. 

-labmask- has been part of -labutil- on SSC for a while: 

labutil from http://fmwww.bc.edu/RePEc/bocode/l
    'LABUTIL': modules for managing value and variable labels / labcopy
copies
    value labels, or swaps them around. labdel deletes / them.  lablog
defines
    value labels for values which are base 10 / logarithms containing
the
    antilogged values. labcd defines value / labels in which decimal
points

It has just been discussed more formally for its uses in graphics: 

SJ-8-2  gr0034  . . . . . . . . . .  Speaking Stata: Between tables and
graphs
        (help labmask, seqvar if installed) . . . . . . . . . . . .  N.
J. Cox
        Q2/08   SJ 8(2):269--289
        outlines techniques for producing table-like graphs

and it has been given puffs by the good people at UCLA: 

FAQ     .  How to assign the val. of a var. as the val. labels of
another var.
        . . . . . . . . . . . . . . . . . .  UCLA Academic Technology
Services
        5/08    http://www.ats.ucla.edu/stat/stata/faq/labmask.htm

Example . Code frag.: Hazard ratio of baseline char. by a dichotomous
variable
        . . . . . . . . . . . . . . . . . .  UCLA Academic Technology
Services
        12/06   http://www.ats.ucla.edu/stat/stata/code/display_hr.htm

Thus, various -search-es for stuff on labels would have pointed you
towards it. 

It is best to install from the Stata Journal website. That way, you get
another utility -seqvar- as part of a 2-for-1 offer. Start with 

. net sj 8-2 gr0034

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

Andrea Bennett

In my case I have to merge two data sets while both of them contain a  
ID variable which is numerical but has label values applied. Now,  
there is an error in the coding for one data set resulting in a shift  
of 10 in the ID variable, e.g. ID in data set 1 is 781 while ID in  
data set 2 is 791. Now, it's easy to change the coding but is there a  
way to automatically re-apply the correct label values after having  
changed the ID coding?

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