Overview (VALUE LABELS command)

VALUE LABELS deletes all existing value labels for the specified variable(s) and assigns new value labels. ADD VALUE LABELS can be used to add new labels or alter labels for specified values without deleting other existing labels.

Basic Specification

The basic specification is a variable name and the individual values with their assigned labels.

Syntax Rules

  • Labels can be assigned to any previously defined variables.
  • It is not necessary to enter value labels for all values for a variable.
  • Each value label must be enclosed in quotes. For string variables, the values themselves must also be quotes.
  • For date format variables (for example, DATE, ADATE), values expressed in date formats must be enclosed in quotes, and values must be expressed in the same date format as the defined date format for the variable.
  • Value labels can contain any characters, including blanks. To enter an apostrophe as part of a label, enclose the label in double quotes or enter two apostrophes (two single quotes). See the topic String Values in Command Specifications for more information.
  • Each value label can be up to 120 bytes long.
  • The same labels can be assigned to the values of different variables by specifying a list of variable names. For string variables, the variables specified must be of equal length.
  • Multiple sets of variable names and value labels can be specified on one VALUE LABELS command as long as the sets are separated by slashes.
  • 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, VALUE 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.
  • VALUE LABELS deletes all previously assigned value labels for the specified variables.
  • The value labels assigned are stored in the dictionary of the working file and are automatically displayed on the output from many procedures.
  • If a specified value is longer than the format of the variable, the program will be unable to read the full value and may not be able to assign the value label correctly.
  • If the value specified for a string variable is shorter than the format of the variable, the value specification is right-padded without warning.