Writes data values to a special buffer from which they can be
written to the data component, and formatted by ODS destinations
| Valid: |
in a DATA step
|
| Category: |
File-handling
|
| Type: |
Executable
|
|
PUT
<specification(s)><_ODS_><@|@@> ;
|
-
specification
-
specifies the variables to write and where
to write them. Each specification has the following form:
<ods-pointer-control>variable
-
ods-pointer-control
-
-
variable
-
identifies the variable to write.
-
_ODS_
-
moves data values for all columns to a buffer.
The order of these columns is determined by the orderthat is specified by
the COLUMNS= or VARIABLES= suboption in the ODS option in the FILE statement.
If you do not specify either of these options, the order of the variables
in the program data vector determines their order in the buffer.
The PUT statement writes this buffer to the data component.
-
@ | @@
-
holds an output line for the execution of
the next PUT statement across iterations of the DATA step. The line-hold specifiers
are called trailing @
and double trailing @
.
Within the DATA step, the ODS option in the FILE statement
and the _ODS_ option in the PUT statement provide connections with the Output
Delivery System (ODS). You use both of these connections to route the results
of a DATA step to ODS. By default, when the DATA step uses ODS, ODS writes
output objects to the procedure output and places links to them in the Results
folder. You can use global ODS statements to write to other ODS destinations.
The FILE and PUT statements interact in the following
ways:
The ODS destinations are controlled by the global ODS
statements. You can use an existing template or create your own with the TEMPLATE.
procedure.
For details on using the Output Delivery System, see The Complete Guide to the SAS Output Delivery System.
Column pointer controls in a DATA step that uses ODS
differ slightly from column pointer controls in a DATA step that does not
use ODS. ODS is not character-based. Therefore, in ODS a column contains the
entire value of a variable. Column 1 contains the first variable in the output;
column 2 contains the second variable, and so on.
Column pointer controls have the following general forms:
-
@ods-column
-
moves the pointer to the specified ODS column.
ods-column can be a number, a numeric-variable,
or an expression that identifies the column to write to.
-
+ods-column
-
moves the pointer the specified number of
columns. ODS-column can be a number, a numeric-variable,
or an expression that specifies the number of columns to move the pointer.
| Range: |
If ods-column is a number, it must be an integer. If ods-column is a variable or an
expression, it does not have to be an
integer. If it isn't, SAS truncates the decimal portion and uses the only
the integer value. |
| Tip: |
If ods-column is greater than 0, the pointer moves to the right. If ods-column is less than 0,
the pointer moves to the left. If ods-column is equal to 0, the pointer does not move.
If the current column position becomes less than 1,
the pointer moves to column 1. If the current column position exceeds the
number of columns in the data component, the ODS writes the current line,
moves the pointer to the first column on the next line, and continues to process
the PUT statement. |
Line pointer controls in a DATA step that uses ODS are
the same as line pointer controls in a DATA step that does not use ODS. Line
pointer controls have the following general forms:
-
#line
-
moves the pointer to the specified line. line can be a number, a numeric-variable, or an expression
that identifies the line to write to.
-
/
-
moves the pointer to the first column of
the next line.
In a DATA step that uses the Output Delivery System,
the number of columns that is specified by the COLUMNS= or VARIABLES= suboption
to the ODS option in the FILE statement determines the number of columns in
the buffer, and eventually, in the data component. If you do not specify either
of these options, the number of the variables in the program data vector determines
the number of columns.
Note:
The template that is combined
with the data component to produce the output object may change the number
of columns that actually appear in the output object.
Using pointer controls and trailing @ or double trailing
@, you may inadvertently position the pointer beyond the last column. You
control how SAS handles this situation with options in the FILE statement.
Copyright © 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.