Title
labvalpool -- Pool (sets of) value labels
Syntax
labvalpool [target-lblname [lblname-list]] [, options]
where
target-lblname is the value label name for pooled sets of value labels
lblname-list are names of value label sets to be pooled
Description
labvalpool pools (sets of) value labels specified in lblname-list. A value label set, target-lblname, is defined, pooling definitions from lblname1, lblname2, .... Not specifying target-lblname and/or lblname-list, means all value labels in memory.
Options
append[(numlist | varlist)] appends value label definitions from lblname-list to target-lblname. Note that target-lblname must exist. If specified, only values in numlist or varlist and the associated text are added from lblname-list. May not be specified with replace.
replace replaces target-lblname with pooled value labels from lblname-list. If target-labelname exists, it is redefined, otherwise a new value label set is defined. May not be specified with append.
update overwrites value label definitions. Later definitions overwrite earlier ones in the order of the specified lblname-list. The synonym overwrite may be used. May not be specified with pool.
pool pools text from value labels. Any text associated with the same values is combined. May not be specified with update.
separator(chars) uses chars to separate pooled value labels. May only be specified with pool. Default separator is " ".
Examples
. clear all . label define foo 1 "one" ,modify . label define foo 2 "two" ,modify . label define foo 3 "three" ,modify
. label define bar 3 "second three" ,modify . label define bar 4 "four" ,modify
. labvalpool foobar foo bar . label list . labvalpool foobar foo bar,replace update . label list foobar . labvalpool foobar foo bar,replace pool . label list foobar
. label drop foobar . labvalpool foo bar ,append . label list
. sysuse nlsw88 ,clear . recode occupation (1/2 = 1 "Higher occupation") ,generate(occ) label(occlbl2) . label list occlbl2 . labvalpool occlbl2 occlbl ,append(occ) . label list occlbl2
Acknowledgments
The problem of combining (sets of) value labels was suggested by Jorge Eduardo Pérez Pérez on Statalist.
Nick Cox proposed a first solution labvalcombine, which is availiable under the link above (or as part of labutil package) and will work with Stata version 8 or higher.
Author
Daniel Klein, University of Kassel, klein.daniel.81@gmail.com
Also see
Online: label
if installed: labvalcombine, labcopy, labvalclone, labutil2