Next: , Previous: , Up: SPSS/PC+ System File Format   [Contents]


6.2 Record 1: Variables Record

The variables record most commonly starts at offset 0x1b0, but it can be placed elsewhere. The record contains instances of the following 32-byte structure:

uint32              value_label_start;
uint32              value_label_end;
uint32              var_label_ofs;
uint32              format;
char                name[8];
union {
    flt64           f;
    char            s[8];
} missing;

The number of instances is the nominal_case_size specified in the main header record. There is one instance for each numeric variable and each string variable with width 8 bytes or less. String variables wider than 8 bytes have one instance for each 8 bytes, rounding up. The first instance for a long string specifies the variable’s correct dictionary information. Subsequent instances for a long string are generally filled with all-zero bytes, although the missing field contains the numeric system-missing value, and some writers also fill in var_label_ofs, format, and name, sometimes filling the latter with the numeric system-missing value rather than a text string. Regardless of the values used, readers should ignore the contents of these additional instances for long strings.

uint32 value_label_start;
uint32 value_label_end;

For a variable with value labels, these specify offsets into the label record of the start and end of this variable’s value labels, respectively. See Record 2: Labels Record, for more information.

For a variable without any value labels, these are both zero.

A long string variable may not have value labels.

uint32 var_label_ofs;

For a variable with a variable label, this specifies an offset into the label record. See Record 2: Labels Record, for more information.

For a variable without a variable label, this is zero.

uint32 format;

The variable’s output format, in the same format used in system files. See System File Output Formats, for details. SPSS/PC+ system files only use format types 5 (F, for numeric variables) and 1 (A, for string variables).

char name[8];

The variable’s name, padded on the right with spaces.

union { … } missing;

A user-missing value. For numeric variables, missing.f is the variable’s user-missing value. For string variables, missing.s is a string missing value. A variable without a user-missing value is indicated with missing.f set to the system-missing value, even for string variables (!). A Long string variable may not have a missing value.

In addition to the user-defined variables, every SPSS/PC+ system file contains, as its first three variables, the following system-defined variables, in the following order. The system-defined variables have no variable label, value labels, or missing values.

$CASENUM

A numeric variable with format F8.0. Most of the time this is a sequence number, starting with 1 for the first case and counting up for each subsequent case. Some files skip over values, which probably reflects cases that were deleted.

$DATE

A string variable with format A8. Same format (including varying padding) as the creation_date field in the main header record (see Record 0: Main Header Record). The actual date can differ from creation_date and from record to record. This may reflect when individual cases were added or updated.

$WEIGHT

A numeric variable with format F8.2. This represents the case’s weight; SPSS/PC+ files do not have a user-defined weighting variable. If weighting has not been enabled, every case has value 1.0.


Next: Record 2: Labels Record, Previous: Record 0: Main Header Record, Up: SPSS/PC+ System File Format   [Contents]