Title
labmv -- Change numeric values to extended missing values preserving value labels
Syntax
labmv [varlist] [if] [in] , mv(numlist | # [mvc] ...) [options]
where mvc is one of the extended missing value codes .a|.b|...|.z
Description
labmv changes numeric values in a specified varlist to extended missing values, preserving their value labels. If no mvc is specified, numeric values are changed to consecutive extended missing value codes, starting with .a. Thus, the first numeric value specified will be coded .a, the second .b and so on. In value labels, any text associated with numeric values will be detached from these values and instead be associated with the corresponding missing value code.
Up to 26 numeric values may be specified in mv. If varlist is not specified it defaults to _all.
Reminder: modifiactions in value labels affect all variables that have the same value label as one of the variables in varlist attached.
Options
mv(numlist | # [mvc]) is a required option and specifies numeric values to be changed to extended missing value codes. The numeric value preceding mvc is changed to mvc. See Remarks.
allvars changes numeric values to extended missing values in all variables that have the same value label as one of the variables in varlist attached.
nodelete prevents labmv from deleting value labels that are changed. If specified numeric missing values and extended missing value codes will be associated with the same text.
fmvc(mvc) specifies the first extended missing value code to be used. Default is .a. Note that the maximum number of values allowed in mv is potentially reduced if mvc > .a.
encode changes extended missing value codes to numeric values, preserving value labels and, thus, reversing the default behavior. The first missing value code (default .a) is changed to the first value specified in mv and so on. In mv, mvc is changed to the numeric value follwing mvc. See Remarks.
current changes value labels in the current label language only.
Remarks
labmv changes one numeric value to one extended missing value code. In
labmv ,mv(1/3)
values 1, 2 and 3 are changed to .a, .b and .c respectively. This is the same as
labmv ,mv(1 .a 2 .b 3 .c)
Specifying mvc changes the numeric value preceding mvc to mvc. In
labmv ,mv(1/3 .f)
only value 3 is changed to .f. Values 1 and 2 are changed to .a and .b respectively.
To reverse the above, type
labmv ,mv(1 2 .f 3) encode
Option fmvc may be specified if mvc is specified in mv. The line
labmv ,mv(1/3 .f) fmvc(.y)
changes values 1 and 2 to .y and .z respectively. Value 3 is changed to .f.
More confusing specifications are allowed. In
labmv ,mv(1/3 .f) fmvc(.e)
values 1 and 2 are changed to .e and .g respectively. Since value 3 is followed by .f it is changed to .f.
Example
. sysuse nlsw88 . tab1 race married . label list racelbl marlbl
Decode missing values . labmv race married ,mv(1 2) . tab1 race married . tab1 race married ,missing . label list racelbl marlbl
Encode missing values . labmv race married ,mv(1 2) encode . tab1 race married . label list racelbl marlbl
Saved results
labmv saves the following in r():
Macros r(values) numeric values r(mvc) extended missing value codes r(varlist) changed variables (if any) r(lblnamelist) changed value labels (if any) r(k) number of numeric values r(minmvc) minimum extended missing value code r(maxmvc) maximum extended missing value code r(languages) label languages (multilingual datasets only)
Acknowledgments
labmv is strongly inspired by nepsmiss (Jan Skopek, Daniel Bela).
Daniel Possenriede suggested user-defined missing value codes in mv.
Author
Daniel Klein, University of Kassel, klein.daniel.81@gmail.com
Also see
Online: mvdecode, label
if installed: labelmiss, nepsmiss, labutil2