Examples (VALUE LABELS command)

Assigning Value Labels to Multiple Variables

VALUE LABELS V1 TO V3 1 'Officials & Managers'
                      6 'Service Workers'
                /V4 'N' 'New Employee'.
  • Labels are assigned to the values 1 and 6 for the variables between and including V1 and V3 in the active dataset.
  • Following the required slash, a label for the value N of V4 is specified. N is a string value and must be enclosed in quotes.
  • If labels exist for the values 1 and 6 on V1 to V3 and the value N on V4, they are changed in the dictionary of the working file. If labels do not exist for these values, new labels are added to the dictionary.
  • Existing labels for values other than 1 and 6 on V1 to V3 and the value N on V4 are deleted.

Combining Strings to Construct Value Labels

VALUE LABELS  OFFICE88 1 "EMPLOYEE'S OFFICE ASSIGNMENT PRIOR"
   + " TO 1988".
  • The label for OFFICE88 is created by combining two strings with the plus sign. The blank between PRIOR and TO must be included in the first or second string to be included in the label.

Value Labels for String Variables

VALUE LABELS=STATE REGION 'U' "UNKNOWN".
  • The label UNKNOWN is assigned to the value U for both STATE and REGION.
  • STATE and REGION must be string variables of equal length. If STATE and REGION have unequal lengths, a separate specification must be made for each, as in
VALUE LABELS STATE 'U' "UNKNOWN" / REGION 'U' "UNKNOWN".

Using Value Labels with DATA LIST

DATA LIST / CITY 1-8(A) STATE 10-12(A).
VALUE LABELS  STATE 'TEX' "TEXAS" 'TEN' "TENNESSEE"
                    'MIN' "MINNESOTA".
BEGIN DATA
AUSTIN   TEX
MEMPHIS  TEN
ST. PAUL MIN
END DATA.
FREQUENCIES VARIABLES=STATE.
  • The DATA LIST command defines two variables. CITY is eight characters wide and STATE is three characters. The values are included between the BEGIN DATA and END DATA commands.
  • The VALUE LABELS command assigns labels to three values of variable STATE. Each value and each label is specified in quotes.
  • The format for the variable STATE must be at least three characters wide because the specified values, TEX, TEN, and MIN, are three characters. If the format for STATE were two characters, the program would issue a warning. This would occur even though the values named on VALUE LABELS and the values after BEGIN DATA agree.

Forcing Value Labels to Wrap

VALUE LABELS myvar 1 "A long value label \n that always wraps".
FREQUENCIES myvar.
Figure 1. Using \n to wrap value labels
Using \n to wrap value labels