Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down at the end of May, and its replacement, statalist.org is already up and running.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: st: How to rename value label names to match variable names?


From   "Nick Cox" <n.j.cox@durham.ac.uk>
To   <statalist@hsphsun2.harvard.edu>
Subject   RE: st: How to rename value label names to match variable names?
Date   Mon, 17 May 2010 12:46:49 +0100

-labmask- is from SSC (in -labutil-) and also from SJ: 

. search labmask

Keyword search

        Keywords:  labmask
          Search:  (1) Official help files, FAQs, Examples, SJs, and
STBs

Search of official help files, FAQs, Examples, SJs, and STBs


FAQ     .  How to assign the val. of a var. as the val. labels of
another var.
        . . . . . . . . . . . . . . . . . .  UCLA Academic Technology
Services
        7/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

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

Just to correct any incorrect impressions here: 

The default of -labmask- is to use values. Only if you ask directly
through the -decode- option will it use value labels. This is all
spelled out in the help, which does have to be read first: 

Title

    labmask -- Assign values or value labels of one variable as value
labels to another


Syntax

        labmask varname [if] [in], values(valuesname) [lblname(lblname)
decode]


Description

    labmask assigns the values (or optionally the value labels) of one
variable valuesname as the value labels
    of another variable varname.  Any existing value labels will be
overwritten.  The idea behind the program
    name is that henceforth the face that varname presents will not be
its own, but a mask borrowed from
    valuesname. Thus, for example, a year variable might be coded by
party winning at election and those value
    labels then shown as labels on a graph axis.

    varname must take on integer values for the observations selected.
valuesname must not vary within groups
    defined by the distinct values of varname for the observations
selected. However, there is no rule that the
    same label may not be assigned to different values of varname.


Options

    values(valuesname) specifies a variable whose values (by default) or
value labels (optionally) will be used
        as the value labels of varname. values() is required.

    lblname(lblname) specifies that the value labels to be defined will
have the label name lblname. The
        default is that they will have the same name as varname. Any
existing value labels for the same values
        will be overwritten in either case.

    decode specifies that the value labels of valuesname should be used
as the value labels of varname. The
        default is to use the values of valuesname.

<etc.> 

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

Anna Reimondos

Thank you all for your further suggestions.
With the labmask, I had not realised that the label values were
dropped, so yes I would definitely need to use the decode option.


*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   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   |   Site index