Chapter Contents |
Previous |
Next |
INPUTC and INPUTN |
Category: | Formatting |
Syntax | |
Details | |
Examples | |
Example 1: Using the INPUTC Function | |
Example 2: Using the INPUTN Function | |
Example 3: Using INPUTN with a DATE Value | |
See Also |
Syntax |
char-value=INPUTC(char-string,char-informat); |
num-value=INPUTN(char-string,num-informat); |
Type: Character
Type: Numeric
Type: Character
Type: Character
Type: Numeric
Details |
INPUTC and INPUTN both read a character value. However, INPUTC applies a character informat and returns a character value, and INPUTN applies a numeric informat and returns a numeric value. These functions are similar to the INPUT function in the DATA step.
Note: Dot notation cannot be used with the INPUTC or
INPUTN functions. This restriction is necessary to allow proper parsing of
the char-informat and num-informat parameters.
For more information about using an informat to read a value, see the INPUT function for the DATA step in SAS Language Reference: Dictionary.
Examples |
Read the character variable NAME, using the $UPCASE3. informat:
name='sas'; cval=inputc(name,'$upcase3.'); put cval=;This program produces the following output:
cval=SAS
Read the character variable AMOUNT, containing the value $20,000.00, into the numeric variable SALARY, using the COMMA10.2 informat:
amount='$20,000.00'; informat='comma10.2'; salary=inputn(amount,informat); put salary=;This program produces the following output:
salary=20000
Read the value in DATE and apply the JULIAN8. informat:
date='90091'; ndate=inputn(date,'julian8.'); put ndate=;This program produces the following output:
ndate=11048
See Also |
Chapter Contents |
Previous |
Next |
Top of Page |
Copyright 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.