![]() Chapter Contents |
![]() Previous |
![]() Next |
| PUT, Named |
| Valid: | in a DATA step |
| Category: | File-handling |
| Type: | Executable |
| Syntax | |
| Arguments | |
| Details | |
| Using Named Output | |
| Formatting Named Output | |
| Examples | |
| See Also | |
Syntax |
| PUT <pointer-control> variable= <format.> <@ | @@>; |
|
PUT variable= start-column
<- end-column>
<.decimal-places> <@ | @@>; |
| See: | Column Pointer Controls and Line Pointer Controls |
variable=value
| Tip: | Ensure that the format width provides enough space to write the value and any commas, dollar signs, decimal points, or other special characters that the format includes. |
| Example: |
This PUT statement uses
the format DOLLAR7.2 to write the value of X:
put x= dollar7.2;When X=100, the formatted value uses seven columns: X=$100.00 |
| See: | Formatting Named Output |
| Range: | positive integer |
| Restriction: | The trailing @ or double trailing @ must be the last item in the PUT statement. |
| See: | Using Line-hold Specifiers |
| Details |
For a complete description of the SAS formats, see Definition .
| Examples |
Use named output in the PUT statement as shown here.
data _null_; input name $ 1-18 score1 score2 score3; put name = @20 score1= score3= ; datalines; Joseph 11 32 76 Mitchel 13 29 82 Sue Ellen 14 27 74 ;
The program writes the following lines to the SAS log:
----+----1----+----2----+----3----+----4 NAME=Joseph SCORE1=11 SCORE3=76 NAME=Mitchel SCORE1=13 SCORE3=82 NAME=Sue Ellen SCORE1=14 SCORE3=74
put item= @25 amount= dollar12.2;
When the value of ITEM is binders and the value of AMOUNT is 153.25, this output line is produced:
----+----1----+----2----+----3----+----4 ITEM=binders AMOUNT=$153.25
| See Also |
Statement:
|
![]() Chapter Contents |
![]() Previous |
![]() Next |
![]() Top of Page |
Copyright © 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.