File Access


Using the PUT Statement

The PUT statement writes lines to the SAS log, to the SAS output file, or to any external file specified in a FILE statement. The file associated with the most recently executed FILE statement is the current output file.

You can use the following arguments with the PUT statement:

variable

names the SAS/IML variable with a value that is put to the current pointer position in the record. The variable must be scalar valued. The put variable can be followed immediately by an output format.

literal

gives a literal to be put to the current pointer position in the record. The literal can be followed immediately by an output format.

(expression)

must produce a scalar-valued result. The expression can be immediately followed by an output format.

format

names the output formats for the values.

pointer-control

moves the output pointer to a line or column.

Pointer Control Features

Most PUT statements need the added flexibility obtained with pointer controls. SAS/IML keeps track of its position on each output line with a pointer. With specifications in the PUT statement, you can control pointer movement from column to column and line to line. The pointer controls available are discussed in the section Using the INPUT Statement.

Differences with the SAS DATA Step

If you are familiar with the SAS DATA step, you will notice that the following features are supported differently or are not supported:

  • The pound sign (#) directive supporting multiple current records is not supported.

  • Grouping parentheses are not supported.

  • The byte operands (< and >) are a new feature supporting binary files.