Next: , Previous: , Up: System File Format   [Contents]


1.4 Value Labels Records

The value label records documented in this section are used for numeric and short string variables only. Long string variables may have value labels, but their value labels are recorded using a different record type (see Long String Value Labels Record).

ReadStat (see File Header Record) writes value labels that label a single value more than once. In more detail, it emits value labels whose values are longer than string variables’ widths, that are identical in the actual width of the variable, e.g. labels for values ABC123 and ABC456 for a string variable with width 3. For files written by this software, PSPP ignores such labels.

The value label record has the following format:

int32               rec_type;
int32               label_count;

/* Repeated n_label times. */
char                value[8];
char                label_len;
char                label[];
int32 rec_type;

Record type. Always set to 3.

int32 label_count;

Number of value labels present in this record.

The remaining fields are repeated count times. Each repetition specifies one value label.

char value[8];

A numeric value or a short string value padded as necessary to 8 bytes in length. Its type and width cannot be determined until the following value label variables record (see below) is read.

char label_len;

The label’s length, in bytes. The documented maximum length varies from 60 to 120 based on SPSS version. PSPP supports value labels up to 255 bytes long.

char label[];

label_len bytes of the actual label, followed by up to 7 bytes of padding to bring label and label_len together to a multiple of 8 bytes in length.

The value label record is always immediately followed by a value label variables record with the following format:

int32               rec_type;
int32               var_count;
int32               vars[];
int32 rec_type;

Record type. Always set to 4.

int32 var_count;

Number of variables that the associated value labels from the value label record are to be applied.

int32 vars[];

A list of 1-based dictionary indexes of variables to which to apply the value labels (see Dictionary Index). There are var_count elements.

String variables wider than 8 bytes may not be specified in this list.


Next: Document Record, Previous: Variable Record, Up: System File Format   [Contents]