INPUTN Function

Enables you to specify a numeric informat at run time.

Category:Special
Returned data type:DOUBLE

Syntax

INPUTN(source, informat[, w[, d]])

Required Arguments

source

specifies a character constant, variable, or expression to which you want to apply the informat.

Data typeCHAR

informat

is a character constant, variable, or expression that contains the numeric informat that you want to apply to source.

Data typeCHAR

Optional Arguments

w

is a numeric constant, variable, or expression that specifies a width to apply to the informat.

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

d

is a numeric constant, variable, or expression that specifies the number of decimal places to use.

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

Comparisons

The INPUTC function enables you to specify a character informat at run time. Using the PUT function is faster because you specify the informat at compile time.

Example

The following program illustrates how to specify numeric informats.

Note: In this example, DS2 statements are sent to SAS using PROC DS2.
proc ds2;
data _null_;
   method init();
      declare double salary;
      salary = inputn('20,000.00', 'comma10.2');
      put salary=;
   end;
enddata;
run;
quit;

SAS writes the following output to the log:

20000

See Also

Last updated: September 2, 2026