writes data to an external file
- PUT <operand> <record-directives>
The inputs to the PUT statement are as follows:
- specifies the value you want to output
to the current position in the record.
The operand can be either a variable name,
a literal value, or an expression in parentheses.
The operand can be followed immediately
by an output format specification.
- start new records.
There are three types:
- holding @
- at the end of a PUT statement, instructs IML to
put a hold on the current record so that IML can
write more to the record with later PUT statements.
Otherwise, IML automatically begins the
next record for the next PUT statement.
- writes out the current record and begins forming a new record.
- > operand
- specifies that the next record written will start at the
indicated byte position in the file (for RECFM=N files only).
The operand is a literal number, a variable
name, or an expression in parentheses, for example,
put >3 x 3.2;
- specify the column on the record to
which the PUT statement should go.
There are two types of positionals:
- @ operand
- specifies to go to the indicated column, where operand is a
literal number, a variable name, or an expression in parentheses.
For example, @30 means to go to column 30.
- + operand
- specifies that the indicated number of columns are to
be skipped, where operand is a literal number,
a variable name, or an expression in parentheses.
- specifies a valid SAS or user-defined output format.
These are of the form w.d or $w. for standard numeric
and character formats, respectively, where w is the width
of the field and d is the decimal parameter, if any.
They can also be a named format of the form
NAMEw.d, where NAME is the name of the format.
If the width is unspecified, then a default
width is used; this is 9 for numeric variables.
The PUT statement writes to the file specified in the previously
executed FILE statement, putting the values from IML variables.
The statement is described in detail in
Chapter 7, "File Access."
The PUT statement is a sequence of positionals
and record directives, variables, and formats.
An example using the PUT statement is shown below:
/* output variable A in column 1 using SAS format 6.4. */
/* Skip 3 columns and output X using format 8.4 */
put @1 a 6.4 +3 x 8.4;
Copyright © 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.