INPUTN Function


INPUTN Function

Enables you to specify a numeric informat at run time

Category: Special

Syntax

INPUTN ( source , informat .<, w <, d >>)

Arguments

source

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

informat.

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

w

  • specifies a width to apply to the informat.

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

d

  • specifies the number of decimal places to use.

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

Comparisons

The INPUTC function enables you to specify a character informat at run time.

Examples

Example 1: Specifying Numeric Informats

The PROC FORMAT step in this example creates a format, READDATE., that formats the variable values 1 and 2 with the name of a SAS date informat. The DATA step creates a SAS data set from raw data originally from two different sources (indicated by the value of the variable SOURCE). Each source specified dates differently. After reading a record, the DATA step uses the value of SOURCE to create a variable, DATEINF, that contains the value of the appropriate informat for reading the date. The DATA step also creates a new variable, NEWDATE, whose value is a SAS date. The INPUTN function assigns the value of NEWDATE based on the source of the observation and the appropriate informat.

 proc format;     value readdate 1='date7.'                    2='mmddyy8.';  run;  options yearcutoff=1920;  data fixdates (drop=start dateinformat);     length jobdesc ;     input source id lname $ jobdesc $ start $;     dateinformat=put(source, readdate.);     newdate = inputn(start, dateinformat);     datalines;  1 1604 Ziminski writer 09aug90  1 2010 Clavell editor 26jan95  2 1833 Rivera writer 10/25/92  2 2222 Barnes proofreader 3/26/98  ; 

See Also

Functions:

  • 'INPUT Function' on page 592

  • 'INPUTC Function' on page 594

  • 'PUT Function' on page 754

  • 'PUTC Function' on page 756

  • 'PUTN Function' on page 758




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