RECORDS Subcommand (DATA LIST command)
RECORDS indicates
the number of records per case for fixed-format data. In the variable
definition portion of DATA LIST, each record is preceded by a slash. By default, DATA LIST reads one record per case.
- The only specification on
RECORDSis a single integer indicating the total number of records for each case (even if theDATA LISTcommand does not define all the records). -
RECORDScan be used only for fixed-format data and must be separated from otherDATA LISTsubcommands by at least one blank or comma.RECORDSmust precede the first slash, which signals the beginning of variable definition. - Each slash in the variable definition portion of
DATA LISTindicates the beginning of a new record. The first slash indicates the first (or only) record. The second and any subsequent slashes tell the program to go to a new record. - To skip a record, specify a slash without any variables for that record.
- The number of slashes in the variable definition
cannot exceed the value of the integer specified on
RECORDS. - The sequence number of the record being defined can
be specified after each slash.
DATA LISTreads the number to determine which record to read. If the sequence number is used, you do not have to use a slash for any skipped records. However, the records to be read must be in their sequential order. - The slashes for the second and subsequent records can be specified within the variable list, or they can be specified on a format list following the variable list (see the example below).
- All variables to be read from one record should be defined before you proceed to the next record.
- Since
RECORDScan be used only with fixed format, it is not necessary to define all the variables on a given record or to follow their order in the input data file.
Example
DATA LIST FILE="/data/hubdata.txt" RECORDS=3
/2 YRHIRED 14-15 DEPT 19 SEX 20.
-
DATA LISTdefines fixed-format data.RECORDScan be used only for fixed-format data. -
RECORDSindicates that there are three records per case in the data. Only one record per case is defined in the data definition. - The sequence number (2) before the first variable definition indicates that the variables being defined are on the second record. Because the sequence number is provided, a slash is not required for the first record, which is skipped.
- The variables YRHIRED, DEPT, and SEX are defined and will be included in the active dataset. Any other variables on the second record or on the other records are not defined and are not included in the active dataset.
Example
DATA LIST FILE="/data/hubdata.txt" RECORDS=3
/ /YRHIRED 14-15 DEPT 19 SEX 20.
- This command is equivalent to the one in the previous example. Because the record sequence number is omitted, a slash is required to skip the first record.
Example
DATA LIST FILE="/data/hubdata.txt" RECORDS=3
/YRHIRED (T14,F2.0) / /NAME (T25,A24).
-
RECORDSindicates there are three records for each case in the data. - YRHIRED is the
only variable defined on the first record. The FORTRAN-like format
specification
T14means tab over 14 columns. Thus, YRHIRED begins in column 14 and has formatF2.0. - The second record is skipped. Because the record sequence numbers are not specified, a slash must be used to skip the second record.
- NAME is the only
variable defined for the third record. NAME begins in column 25 and is a string variable with a width of 24
bytes (format
A24).
Example
DATA LIST FILE="/data/hubdata.txt" RECORDS=3
/YRHIRED NAME (T14,F2.0 / / T25,A24).
- This command is equivalent to the one in the previous example. YRHIRED is located on the first record, and NAME is located on the third record.
- The slashes that indicate the second and third records are specified within the format specifications. The format specifications follow the complete variable list.