help labcpy
-------------------------------------------------------------------------------

Title

labcpy -- Modify copy of value label

Syntax

labcpy oldlblname newlblname [ modifications ] [, replace values( varlist)]

where the form of modifications is one of

# "label" [# "label" ...]

(numlist = numlist) [...]

Description

labcpy defines newlblname as a (modified) copy of oldlblname. If no modifications are specified, oldlblname is copied as is.

Options

replace redefines the copied value label. This option might be useful to delete multiple values from newlblname. The option is not allowed if modifications are specified as rules. Note that newlblname must not exist, regradless of whether replace is specified or not.

values(varlist) attaches newlblname to varlist.

Remarks

Modifications may either be specified as integer-to-text mappings or as rules. Integer-to-text mappings are specified the same way as with label define. Modification rules are similar to those used with recode, with few exceptions. Recoding into a numlist is allowed. Instead of

(1 = 4)(2 = 3)(3 = 2)(4 = 1)

you may code

(1/4 = 4/1)

Note, however, that numlists must define one-to-one mappings. You may delete values from copied value labels by mapping them to sysmiss (.). It is not allowed to specify labels in rules.

Examples

. sysuse auto . labcpy origin org 1 "German" 2 "Other"

. sysuse nlsw88 . generate byte race2 = race * 10 . labcpy racelbl race2 (1/3 = 10(10)30) ,values(race2)

Acknowledgments

Modifying value labels by specifying rules is inspired by labvalch (Nick Cox).

Author

Daniel Klein, University of Bamberg, klein.daniel.81@gmail.com

Also see

Online: label

if installed: labvalclone, labvalch, labutil2