![]() | ![]() | ![]() | ![]() |
This sample illustrates an approach for creating dynamic parameter values when running a stored process on the SAS Workspace Server.
SAS Note 19475 "Creating dynamic parameter values for a stored process" discusses using the SAS® Stored Process Server. In most cases the SAS Stored Process Server is the best choice when running a stored process that needs dynamic parameter values. However, the Workspace Server provides the capability of running a stored process using the client user's account (using all of the client account's operating system permissions) while the SAS Stored Process Server runs under the SAS General Server login account.
In SAS® 9.2 and later, the Prompting Framework supports dynamic prompts. So, if you are running SAS 9.2 or later, you should consider using the Prompting Framework rather than the approach described in this example.
Here are some notes.
These sample files and code examples are provided by SAS Institute Inc. "as is" without warranty of any kind, either express or implied, including but not limited to the implied warranties of merchantability and fitness for a particular purpose. Recipients acknowledge and agree that SAS Institute shall not be liable for any damages whatsoever arising out of their use of this material. In addition, SAS Institute will provide no support for the materials contained herein.
This stored process must be executed using the SAS Workspace Server or using the SAS Stored Process Server (using Package Output).
/************************************************************
This stored process provides an example of creating an
HTML page with dynamically-generated parameter values.
This HTML page is then used to submit a request to the
stored process using the parameter value that was selected.
This example requires PACKAGE output; not streaming.
It can be executed using the Workspace Server or using
the SAS Stored Process Server (using Package Output).
SAS Usage Note 19475 provides an example of using
Streaming Output using the Stored Process Server.
***********************************************************/
*ProcessBody;
%macro main;
%global reqtype _namevalue;
%macro first;
%stpbegin;
%LET _namevalue=%STR(_default_entry=firstout.html);
filename firstout "&_stpwork/firstout.html";
/* This is the first request. List age groups. */
proc summary data=sashelp.class;
class age;
output out=means;
run;
data _null_;
set means end=alldone;
file firstout;
if _n_ = 1 then do;
thissrv = "&_URL";
thispgm = "&_PROGRAM";
put '<br>';
put '<h1>Example 1</h1>';
put '<FORM ACTION="' thissrv +(-1) '" method=get>';
put '<input type="hidden" name="_program" value="'
thispgm +(-1) '">';
put '<input type="hidden" name=reqtype value="print">';
put '<br>';
put '<b>Select Age: </b>';
put '<select name="age">';
end;
if age ne . then do;
put '<OPTION VALUE="' age '">' age;
end;
if alldone then do;
put '</select>';
put '<br><br>';
put '<input type="submit" value="Submit Request">';
put '</form>';
end;
run;
%stpend;
%mend first;
%macro report;
/* User requested a report */
%stpbegin;
%LET _namevalue=%STR(_default_entry=main.html);
Title "Students who are age &age";
proc print data=sashelp.class;
where age= &age;
run;
%stpend;
%mend report;
%if "&reqtype" = "print" %then %do;
/* Produce the report */
%report;
%end;
%else %do;
/* First request. Display Selection window. */
%first;
%end;
%mend main;
%main;
These sample files and code examples are provided by SAS Institute Inc. "as is" without warranty of any kind, either express or implied, including but not limited to the implied warranties of merchantability and fitness for a particular purpose. Recipients acknowledge and agree that SAS Institute shall not be liable for any damages whatsoever arising out of their use of this material. In addition, SAS Institute will provide no support for the materials contained herein.
| Type: | Sample |
| Date Modified: | 2009-06-30 12:03:51 |
| Date Created: | 2009-04-21 15:19:39 |
| Product Family | Product | Host | SAS Release | |
| Starting | Ending | |||
| SAS System | SAS Integration Technologies | z/OS | 9.1 TS1M3 SP4 | |
| Microsoft® Windows® for 64-Bit Itanium-based Systems | 9.1 TS1M3 SP4 | |||
| Microsoft Windows Server 2003 Datacenter 64-bit Edition | 9.1 TS1M3 SP4 | |||
| Microsoft Windows Server 2003 Enterprise 64-bit Edition | 9.1 TS1M3 SP4 | |||
| Microsoft Windows XP 64-bit Edition | 9.1 TS1M3 SP4 | |||
| Microsoft Windows NT Workstation | 9.1 TS1M3 SP4 | |||
| Microsoft Windows Server 2003 Datacenter Edition | 9.1 TS1M3 SP4 | |||
| Microsoft Windows Server 2003 Enterprise Edition | 9.1 TS1M3 SP4 | |||
| Microsoft Windows Server 2003 Standard Edition | 9.1 TS1M3 SP4 | |||
| Microsoft Windows XP Professional | 9.1 TS1M3 SP4 | |||
| Windows Vista | 9.1 TS1M3 SP4 | |||
| 64-bit Enabled AIX | 9.1 TS1M3 SP4 | |||
| 64-bit Enabled HP-UX | 9.1 TS1M3 SP4 | |||
| 64-bit Enabled Solaris | 9.1 TS1M3 SP4 | |||
| HP-UX IPF | 9.1 TS1M3 SP4 | |||
| Linux | 9.1 TS1M3 SP4 | |||
| Linux on Itanium | 9.1 TS1M3 SP4 | |||
| OpenVMS Alpha | 9.1 TS1M3 SP4 | |||
| Solaris for x64 | 9.1 TS1M3 SP4 | |||
| Tru64 UNIX | 9.1 TS1M3 SP4 | |||



