STP Procedure

INPUTPARAM Statement

Defines input parameters for the execution of the stored process

Syntax

INPUTPARAM parameter-name<=”parameter-value”>
<parameter-name<=”parameter-value”>>;

Required Argument

parameter-name<=“parameter-value”>
specifies input parameter names, or specifies input parameters as name/value pairs where the values are quoted strings. Each name or name/value pair is converted to a SAS macro, which can be used in the stored process. The parameter name is the name of the macro variable that contains the parameter value. The parameter name must be a valid macro variable name and cannot be longer than 32 characters in length. You can specify a parameter value, as follows:
“parameter-value” specify the value for the input parameter. The parameter value can be any string up to 32767 characters in length.
Note: If an input parameter is defined in metadata, then the INPUTPARAM values must reconcile with any limitations that have been specified for them in metadata.

Examples

Example 1

The following example executes a stored process with various input parameters:
PROC STP PROGRAM="/Products/SAS Intelligence Platform/Samples/
      Example Stored Process";
   INPUTPARAM _ODSSTYLE="Blue" _ODSDEST="PDF" YEAR="2010";
   ...
   RUN;

Example 2

The following example shows an INPUTPARAM statement without a specified value. The value of the local variable with the same name is used.
%let testval=23;
 
PROC STP PROGRAM='/Users/johndoe/procstp/Inparam';
   inputparam  testval;
run;
The stored process receives TESTVAL=23. It is the same as if the INPUTPARAM statement was the following:
Inputparam testval=’&testval’;

Example 3

In the following example, the input parameter x is defined in metadata as a numeric value that must be within the range of 5-10.
PROC STP PROGRAM='/Users/johndoe/procstp/Inparm';
   inputparam x='4';  /* does not reconcile with metadata */
run;
Because the value specified in the INPUTPARAM statement does not reconcile with limitations that have been specified in metadata, the stored process does not run. It returns the following error message:
ERROR: STP: An error occurred preprocessing input parameters:
         com.sas.prompts.InvalidPromptValueException: An error occurred for the 
         prompt "x" (values: 4).The value must be greater than or equal to 5.

Example 4

In the following example, INPUTPARAM is overloaded with multiple values:
PROC STP PROGRAM='/Users/johndoe/procstp/Inparam';
   inputparam x='5' x='6' x='7';
run;
The SAS macro variables that are created for the x parameter are as follows:
        X0 3
        X 5
        X1 5
        X2 6
        X3 7
where the value for each SAS macro variable is described as follows:
X0 specifies the number of duplicate macros.
X specifies the value of the first instance of a duplicate macro.
X1 specifies the value of the first duplicate; this value is always the same as the value for X.
X2 specifies the value of the second duplicate.
X3 specifies the value of the third duplicate.
Xn specifies the value of the nth duplicate.
Note: This is the same strategy for specifying duplicate macros as used in SAS/IntrNet and the SAS Stored Process Server.