help elabel define

Title

elabel define -- Define and modify value labels

Syntax

Basic syntax

elabel define
elblnamelist
# "label"
[ # "label" ... ]
[ , options ]

Extended syntax

elabel define
elblnamelist
(valspec)
(lblspec)
[ , options ]

elabel define
elblnamelist
=
fcn(arguments)
[ , options ]

where, with few exceptions, elblnamelist may contain
varname:elblname

valspec is one of
{#|numlist}, or,
=eexp

and numlist may contain sequences of missing value codes
such as .a/.c

lblspec is one of
"label" [ "label" ... ], or,
=eexp

fcn() is an
elabel (pseudo-)function and
arguments are function specific

Description

elabel define defines new value labels or modifies existing value
labels.

The basic syntax mirrors that of label define, except that
more than one value label name may be specified. The extended syntax is
described under Remarks.

Remarks

Remarks are presented under the following headings

Define new value labels

Modify or replace existing value labels

Noninteger values in eexp

elabel (pseudo-)functions (third syntax)

Further extended syntax: recoding rules

Define new value labels

If you define new value labels with the second syntax, specify as many
labels in lblspec as there are values in numlist; the mapping
of values to labels is one-to-one. If only one label is specified, this
label is associated with all values in numlist; you typically do
not want to map different values to the same label.

If you define new value labels with the second syntax, you may specify
eexp only in one of valspec or lblspec but not in both. If
eexp is specified in valspec, only the @ character may be
used; it refers to labels in lblspec. If eexp is specified in
lblspec, only the # character may be used; it refers to the
values in valsepc.

Modify or replace existing value labels

If you modify or replace existing value labels with the second syntax,
specify as many labels in lblspec as there are values in numlist;
the mapping of values to labels is one-to-one. If only one label is
specified, this label is associated with all values in numlist; this
is useful for deleting integer-to-text mappings from value labels.

If you modify or replace existing value labels with the second syntax, you
may specify eexp in both valspec and lblspec. In both,
valspec and lblspec, the # character refers to the values
of the value labels in elblnamelist and the @ character refers
to the text of value labels in elblnamelist.

If you modify or replace existing value labels and specify eexp,
you typically want to specify eexp in both valspec and
lblspec. If existing value labels are modified or replaced and if
eexp is specified in only one of valspec or lblspec, the
meaning of the # character and @ character might not be what
you expect: In valspec, the # character refers to the values
of the value labels in elblnamelist that are associated with the
labels in lblspec; the @ character refers to the labels in
lblspec. Likewise, in lblspec, the # character refers to
the values in valspec; the @ character refers to the text of
the value labels in elblnamelist that is associated with the values
in valspec.

Noninteger values

If eexp in valspec evaluates to noninteger values, these values
are truncated; eexp may not evaluate to system missing.

elabel (pseudo-)functions

With the third syntax, you specify an
elabel (pseudo-)function
to define new or modify existing value labels. See
elabel (pseudo-)functions
for a list of available (pseudo-)functions.

Further extended syntax: recoding rules

elabel define accepts recoding rules similar to those used
with the recode command for manipuating variables. If you
are interested in using recoding rules for manipulating value labels,
you probably want to use elabel recode.

The syntax for using recoding rules with elabel define is

elabel define
elblnamelist
(rule)
[ (rule) ... ]
, {add|modify|replace} [ nofix ]

where rule is explained in
elabel recode. When you specify recoding rules
with elabel define, you may modify or replace existing value
labels but you cannot define new value labels.

Options

add is the same as with label define,
and adds integer to text mappings to a value label.

modify is the same as with label define,
and modifies existing value labels.

replace is the same as with label define,
and redefines value labels.

nofix is the same as with label define.

Examples

Define value label yesno

. elabel define yesno 0 "yes" 1 "no"

Interchange the values in value label yesno

. elabel define yesno (= 1-#) (= @) , modify

Add labels for missing answers to value label yesno

. elabel define yesno (.a/.c) ("don't know" "refused" "N/A") , add

Saved results

elabel define, if rules are specified, saves the
following in r():

Macros

r(rules) transformation rules with all labels removed

Author

Daniel Klein

University of Kassel

klein.daniel.81@gmail.com

Also see

Online: label

if installed: elabel