Parameters with multiple
values (or alternatively, multiple input parameters with the same
name) can be useful in some stored processes. For example, an HTML
input form that is used to drive a stored process might contain a
group of four check boxes, each named CBOX. The value associated with
each box is optOne, optTwo, optThree, and optFour. The HTML for these
check boxes might be
<input type="CHECKBOX" name="CBOX" value="optOne">
<input type="CHECKBOX" name="CBOX" value="optTwo">
<input type="CHECKBOX" name="CBOX" value="optThree">
<input type="CHECKBOX" name="CBOX" value="optFour">
If you select all four boxes and submit the form to the SAS Stored
Process Web Application, then the query string looks like this:
&CBOX=optOne&CBOX=optTwo&CBOX=optThree&CBOX=optFour
Macro variables cannot
hold more than one value. The two types of servers that execute stored
processes handle this problem in different ways.
The stored process server
uses a macro variable naming convention to pass multiple values to
the stored process. A numeric suffix is added to the parameter name
to distinguish between values. The number of values is set in <
param-name> 0, the first value is set in <
param-name>1, and so on. In the previous example,
the following macro variables are set as shown in the following table:
Automatically Generated Variables
|
|
|
Specifies the first
value.
|
|
Specifies the number
of values.
|
|
Specifies the first
value.
|
|
Specifies the second
value.
|
|
Specifies the third
value.
|
|
Specifies the fourth
value.
|
Note that the original
parameter macro variable (
CBOX
) is
always set to the first parameter value.
Any client application
can generate multiple value parameters. The typical uses for multiple
values are check box groups in HTML input forms and selection lists
that allow multiple selection.
If the parameter name
is the same as one of the generated variables, then the following
error is returned:
Multiple definitions of a prompt name are not allowed. Certain prompt types
expand to multiple prompt names.