You can specify input parameters as a sequence of name/value
pairs in a URL by using the query string syntax. For example, the
following URL specifies two name/value pairs.
http://yourserver/SASStoredProcess/do?
_program=/WebApps/Sales/Weekly+Report®ion=West
The URL specifies your
server, an absolute path to your Stored Process Web Application, and
the query string (following the question mark character). Each name
in the query string is separated from the following value by an equal
sign (=). Multiple name/value pairs are separated by ampersand characters
(&). In this example,
_program=/WebApps/Sales/Weekly+Report
is the reserved input parameter that specifies the stored process
that is to be executed. The second name/value pair (
region=West
) is another input parameter to be passed to the stored process.
There are special rules
for the formatting of name/value pairs in a URL. Special characters
(such as most punctuation characters, including spaces) in a value
must be URL-encoded. Spaces can be encoded as a plus sign (+) or %20.
Other characters are encoded using the %
nn convention, where
nn is the
hexadecimal representation of the character in the ASCII character
set. In the previous example, the value
/WebApps/Sales/Weekly+Report
actually identifies the stored process named "Weekly Report". The
space in the name is encoded as a plus sign (+). If your parameter
values contain special characters, then it is important that they
are URL-encoded. Use the URLENCODE DATA step function when creating
URLs in a stored process.
URLs are typically used
in an HTML tag attribute, and this might require extra encoding to
be properly interpreted. The ampersand characters that are used in
the URL query string can cause the Web browser to interpret them as
HTML markup. The parameter
®ion=West
is interpreted as
®ion=West
in
some Web browsers. Use HTML encoding to avoid this problem. The following
example shows the correct HTML code:
<A HREF="http://yourserver/SASStoredProcess/do?
_program=/WebApps/Sales/Weekly+Report&region=West">
The HTMLENCODE DATA
step function can be used to encode the URL in a stored process. If
we assume that the variable
myurl
contains
a URL with various input parameters, then the following code creates
an anchor tag in the variable
atag
that is
properly encoded:
atag = '<A HREF="' || htmlencode(myurl,
'lt gt amp quot') || '">';
Note that some Web browsers
and Web servers might impose a limit on the total length of a URL.
URLs with many parameter values that exceed this limit can be truncated
without warning, which results in incomplete or inconsistent input
data for your stored process. URL length limits are not well documented
and might require experimentation with your particular configuration.