Title
labunab -- Unabbreviate value label list
Syntax
labunab lmacname : lblname-list [, clear all]
where lblname-list is a list of abbreviated value labels.
Description
labunab unabbreviates a list of existing value labels and returns the results in lmacname. The command is intended for use by programmers.
Like in varlists the wildcards *, ? and ~ are allowed in lblname-list. It is not allowed to specify a range of value labels using the dash character (-). The keyword _all is allowed but is seldom used. It is best used with option all because otherwise lmacname merely conatains a list of all value labels in memory. This list is accessible referring to r(names) anyway. The reason is that labunab uses label dir internally.
In a program that allows an abbreviated list of value label names you would code
program foo version 9.2 syntax anything labunab lbllist : `anything' code referring to `lbllist' ... end
Options
clear clears lmacname before unabbreviating lblname-list. This option assures that lmacname will be empty if one of the labels in lblname-list is not found, even if the same lmacname has previously been used.
all interprets value labels attached to variables as existing even if they are not currently in memory. The option is seldom used.
Examples
. sysuse nlsw88
. labunab lbllist : ra mar . label list `lbllist'
. labunab short : ???lbl . display "`short'"
. labunab list : some* (will return error message)
. label values south southlbl (note that southlbl has never been defined)
. labunab list : _all ,all . display "`list'" . display "`r(names)'"
. labunab empty : occ . labunab empty : some* . display "`empty'" . labunab empty : some* ,clear . display "`empty'"
Acknowledgments
The code storing results in lmacname is borrowed from official Stata's unab.
Author
Daniel Klein, University of Bamberg, klein.daniel.81@gmail.com
Also see
Online: unab, label
if installed: labutil2