Overview (RECORD TYPE command)
RECORD TYPE
is used with DATA LIST
within
a FILE TYPE—END FILE TYPE
structure to define any one of the three types of complex raw data
files: mixed files, which
contain several types of records that define different types of cases; hierarchical or nested files, which contain several
types of records with a defined relationship among the record types;
or grouped files, which
contain several records for each case with some records missing or
duplicated (see FILE TYPE
for
more complete information). A fourth type of complex file, files with repeating groups of information, can
be read with the REPEATING DATA
command. REPEATING DATA
can
also be used to read mixed files and the lowest level of nested files.
Each type of complex file has varying types of records.
One set of RECORD TYPE
and DATA LIST
commands is used to define each
type of record in the data. The specifications available for RECORD TYPE
vary according to whether MIXED
, GROUPED
, or NESTED
is specified on FILE TYPE
.
Basic Specification
For
each record type being defined, the basic specification is the value
of the record type variable defined on the RECORD
subcommand on FILE TYPE
.
-
RECORD TYPE
must be followed by aDATA LIST
command defining the variables for the specified records, unlessSKIP
is used. - One pair
of
RECORD TYPE
andDATA LIST
commands must be used for each defined record type.
Syntax Rules
- A list of values can be specified if a set of different record types has the same variable definitions. Each value must be separated by a space or comma.
- String values must be enclosed in quotes.
- For mixed files, each
DATA LIST
can specify variables with the same variable name, since each record type defines a separate case. For grouped and nested files, the variable names on eachDATA LIST
must be unique, since a case is built by combining all record types together onto a single record. - For mixed files,
if the same variable is defined for more than one record type, the
format type and width of the variable should be the same on all
DATA LIST
commands. The program refers to the firstDATA LIST
command that defines a variable for the print and write formats to include in the dictionary of the active dataset. - For nested
files, the order of the
RECORD TYPE
commands defines the hierarchical structure of the file. The firstRECORD TYPE
defines the highest-level record type, the nextRECORD TYPE
defines the next highest-level record, and so forth. The lastRECORD TYPE
command defines a case in the active dataset.
Operations
- If a record
type is specified on more than one
RECORD TYPE
command, the program uses theDATA LIST
command associated with the first specification and ignores all others. - For
NESTED
files, the first record in the file should be the type specified on the firstRECORD TYPE
command—the highest-level record of the hierarchy. If the first record in the file is not the highest-level type, the program skips all records until it encounters a record of the highest-level type. If theMISSING
orDUPLICATE
subcommands have been specified on theFILE TYPE
command, these records may produce warning messages but will not be used to build a case in the active dataset.