![]() Chapter Contents |
![]() Previous |
![]() Next |
| PUTN |
| Category: | Special |
| Syntax | |
| Arguments | |
| Comparisons | |
| Examples | |
| Example 1: Specifying a Numeric Format | |
| See Also | |
Syntax |
| PUTN(source, format.<,w<,d>>) |
| Interaction: | If you specify a width here, it overrides any width specification in the format. |
| Interaction: | If you specify a number here, it overrides any decimal-place specification in the format. |
| Comparisons |
The PUTC function enables you to specify a character format at run time.
| Examples |
The PROC FORMAT step in this example creates a format, WRITFMT., that formats the variable values 1 and 2 with the name of a SAS date format. The DATA step creates a SAS data set from raw data consisting of a number and a key. After reading a record, the DATA step uses the value of KEY to create a variable, DATEFMT, that contains the value of the appropriate date format. The DATA step also creates a new variable, DATE, whose value is the formatted value of the date. PUTN assigns the value of DATE based on the value of NUMBER and the appropriate format.
proc format;
value writfmt 1='date9.'
2='mmddyy10.';
run;
data dates;
input number key;
datefmt=put(key,writfmt.);
date=putn(number,datefmt);
datalines;
15756 1
14552 2
;
| See Also |
| Functions:
|
![]() Chapter Contents |
![]() Previous |
![]() Next |
![]() Top of Page |
Copyright 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.