PUTN Function


Enables you to specify a numeric format at run time

Category: Special

Syntax

PUTN ( source , format .<, w <, d >>)

Arguments

source

  • is the SAS expression to which you want to apply the format.

format .

  • is an expression that contains the numeric format you want to apply to source .

w

  • specifies a width to apply to the format.

  • Interaction: If you specify a width here, it overrides any width specification in the format.

d

  • specifies the number of decimal places to use.

  • Interaction: If you specify a number here, it overrides any decimal-place specification in the format.

Details

If the PUTN function returns a value to a variable that has not yet been assigned a length, by default the variable is assigned a length of 200.

Comparisons

The PUTC function enables you to specify a character format at run time.

Examples

Example 1: Specifying a Numeric Format

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:

  • 'INPUT Function' on page 592

  • 'INPUTC Function' on page 594

  • 'INPUTN Function' on page 596

  • 'PUT Function' on page 754

  • 'PUTC Function' on page 756




SAS 9.1 Language Reference Dictionary, Volumes 1, 2 and 3
SAS 9.1 Language Reference Dictionary, Volumes 1, 2 and 3
ISBN: N/A
EAN: N/A
Year: 2004
Pages: 704

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net