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 on April 23, and its replacement, 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" <>
To   <>
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

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

Example . Code frag.: Hazard ratio of baseline char. by a dichotomous
        . . . . . . . . . . . . . . . . . .  UCLA Academic Technology

SJ-8-2  gr0034  . . . . . . . . . .  Speaking Stata: Between tables and
        (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: 


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


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


    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.


    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.



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:

© Copyright 1996–2016 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index