RECORDS Subcommand (WRITE command)

RECORDS indicates the total number of lines written per case. The number specified on RECORDS is informational only. The actual specification that causes variables to be written on a new line is a slash within the variable specifications. Each new line is requested by another slash.

  • RECORDS must be specified before the slash that precedes the start of the variable specifications.
  • The only specification on RECORDS is an integer to indicate the number of records for the output. If the number does not agree with the actual number of records indicated by slashes, the program issues a warning and ignores the specification on RECORDS.
  • Specifications for each line of output must begin with a slash. An integer can follow the slash, indicating the line on which values are to be written. The integer is informational only. It cannot be used to rearrange the order of records in the output. If the integer does not agree with the actual record number indicated by the number of slashes in the variable specifications, the integer is ignored.
  • A slash that is not followed by a variable list generates a blank line in the output.

Examples

WRITE OUTFILE='/data/personnel.txt' RECORDS=2
  /EMPLOYID NAME DEPT
  /EMPLOYID TENURE SALARY.
EXECUTE.
  • WRITE writes the values of an individual’s name and department on one line, tenure and salary on the next line, and the employee identification number on both lines.
    WRITE OUTFILE='/data/personnel.txt' RECORDS=2
      /1 EMPLOYID NAME DEPT
      /2 EMPLOYID TENURE SALARY.
    EXECUTE.
  • This command is equivalent to the command in the preceding example.
    WRITE OUTFILE='/data/personnel.txt' / EMPLOYID NAME DEPT / EMPLOYID TENURE SALARY.
    EXECUTE.
  • This command is equivalent to the commands in both preceding examples.