Previous Page | Next Page

Statements

PUT Statement, Column



Writes variable values in the specified columns in the output line.
Valid: in a DATA step
Category: File-handling
Type: Executable

Syntax
Arguments
Details
Examples
See Also

Syntax

PUT variable start-column <-- end-column>
<.decimal-places> <@ | @@>;


Arguments

variable

specifies the variable whose value is written.

start-column

specifies the first column of the field where the value is written in the output line.

-- end-column

specifies the last column of the field for the value.

Tip: If the value occupies only one column in the output line, omit end-column.
Example: Because end-column is omitted, the values for the character variable GENDER occupy only column 16:
put name 1-10 gender 16;
.decimal-places

specifies the number of digits to the right of the decimal point in a numeric value.

Range: positive integer
Tip: If you specify 0 for d or omit d, the value is written without a decimal point.
Featured in: Examples
@| @@

holds an output line for the execution of the next PUT statement even across iterations of the DATA step. These line-hold specifiers are called trailing @ and double trailing @.

Requirement: The trailing @ or double trailing @ must be the last item in the PUT statement.
See: Using Line-Hold Specifiers

Details

With column output, the column numbers indicate the position that each variable value will occupy in the output line. If a value requires fewer columns than specified, a character variable is left-aligned in the specified columns, and a numeric variable is right-aligned in the specified columns.

There is no limit to the number of column specifications you can make in a single PUT statement. You can write anywhere in the output line, even if a value overwrites columns that were written earlier in the same statement. You can combine column output with any of the other output styles in a single PUT statement. For more information, see Using Multiple Output Styles in a Single PUT Statement.


Examples

Use column output in the PUT statement as shown here.


See Also

Statement:

PUT Statement


FOOTNOTE 1:   The ruled line is for illustrative purposes only; the PUT statement does not generate it. [arrow]

Previous Page | Next Page | Top of Page