Overview (VARIABLE LABELS command)
VARIABLE LABELS
assigns
descriptive labels to variables in the active dataset.
Basic Specification
The basic specification is a variable name and the associated label in quotes.
Syntax Rules
- Labels can be added to any previously defined variable. It is not necessary to enter labels for all variables in the active dataset.
- Each variable label must be enclosed in quotes.
- Variable labels can contain any characters, including blanks. To enter an apostrophe as part of a label, enclose the label in double quotes or enter a two apostrophes (two single quotes). See the topic String Values in Command Specifications for more information.
- Each variable label can be up to 256 bytes long, although some procedures print fewer than the 256 bytes. All statistical procedures display at least 40 bytes.
- Multiple variables
can be assigned labels on a single
VARIABLE LABELS
command. Only one label can be assigned to each variable, and each label can apply to only one variable. - To continue a label from one command line to the next, specify a plus (+) sign before the continuation of the label. Each string segment of the label must be enclosed in quotes. To insert a blank between the strings, the blank must be included in the label specification.
- To control line wrapping of labels in pivot tables and charts,
insert
\n
as part of the label wherever you want a line break. The\n
is not displayed in output; it is interpreted as a line-break character. (Note: Labels will always wrap wherever\n
appears in the defined label, even if there is enough space to display the label without wrapping.)
Operations
- Unlike most transformations,
VARIABLE LABELS
takes effect as soon as it is encountered in the command sequence. Thus, special attention should be paid to its position among commands. See the topic Command Order for more information. - Variable labels are automatically displayed in the output from many procedures and are stored in the dictionary of the active dataset.
-
VARIABLE LABELS
can be used for variables that have no previously assigned variable labels. If a variable has a previously assigned variable label, the new label replaces the old label.