help for lablist(Roger Newson)

List value labels (if present) for one or more variables

lablist [ varlist ] [ , varlabel nounlabelled
local(name) ]

Description

lablist produces a list of the values and value labels
used by the value label sets belonging to each of a list of variables,
if such value label sets are defined.
If no varlist is specified,
then lablist uses the full list of variables in the dataset currently in the memory.
lablist is therefore similar to label list,
but it requires the user to specify only the variable name(s) in the varlist,
instead of specifying the value label set(s)
belonging to the variable(s).
It is often used with tabulate, or with the SSC package xcontract.

Options

varlabel specifies that variable labels will be printed (if present),
in addition to any value labels.

nounlabelled specifies that variables in the varlist without value labels
will not be included in the printed output.

local(name) specifies the name of a local macro to contain a list of value label names
used by variables in the varlist, in alphanumeeric order.

Examples

. lablist

. lablist mpg

. tab foreign

. lablist foreign

. lablist, varlabel

. lablist foreign, var

. lablist, nounlabelled

Saved results

lablist saves the following in r():

Scalars

r(k) number of mapped values, including missing

r(min) minimum nonmissing value with a label

r(max) maximum nonmissing value with a label

r(hasemiss) 1 if extended missing values labeled, 0
otherwise

Macros

r(names) list of label names in alphanumeric order

If multiple variables are specified in the varlist,
then the saved scalar results are for the last variable in the varlist with a value label.

Author

Roger Newson, Imperial College London, UK.

Email: r.newson@imperial.ac.uk

Also see

Manual: [D] label, [D] tabulate oneway, [D] tabulate twoway

On-line: help for label, tabulate, tabulate oneway, tabulate twoway,

help for xcontract if installed