![]() | ![]() | ![]() |
Normally, SAS Information Map Studio and SAS Web Report Studio do not support optional prompts in stored processes. This sample provides code that can be used to create an optional prompt for a stored process that can be used by SAS Web Report Studio and SAS Information Map Studio. The idea is to assign a default value like "All" and then use SAS code to create the filter.

Note: In SAS® 9.2, the stored process framework enables you to define a prompt with values that are not required.
This sample uses the SASHELP.CLASS table as input to the stored process. The prompted parameters are on Name and Sex. The default value for the prompts will be "ALL".
This code checks for the word "ALL". When "ALL" is found, the code sets a dummy string of "1=1", which represents a true condition.
*Processbody;
%stpbegin;
data _NULL_;
/* create temporary variables */
length where temp1 temp2 $100;
If strip(upcase("&name")) ne "ALL" then
temp1 = "strip(upcase(name)) ='" !! strip(upcase("&name"))
!!"'";
else temp1 = "(1 = 1)";
If strip(upcase("&sex")) ne "ALL" then
temp2 = "strip(upcase(sex)) ='" !! strip(upcase("&sex"))
!! "'";
else temp2 = "(1 = 1)";
where = "where " !! strip(temp1) !! " and "
!! strip(temp2);
put where=; /* simply outputting the value to the log for testing */
/* write the value of the where variable to a macro variable called
"Where" */
call symput("where",where);
run;
Proc print data = sashelp.class;
&where; /* Get the value of the where macro created above */
run;
%stpend;
|
When you register the stored process in SAS® Management Console, add parameters for Name and Sex, and set the default value to All.
Note: Make sure that you register the stored process under BI Manager ► BIP Tree ► ReportStudio ► Shared ► Reports ► StoredProcesses.
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.
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-08-07 16:41:04 |
| Date Created: | 2009-07-09 17:05:22 |
| Product Family | Product | Host | Product Release | SAS Release | ||
| Starting | Ending | Starting | Ending | |||
| SAS System | SAS Web Report Studio | Microsoft Windows 2000 Advanced Server | 3.1 | 9.1 TS1M3 SP4 | ||
| Microsoft Windows 2000 Datacenter Server | 3.1 | 9.1 TS1M3 SP4 | ||||
| Microsoft Windows 2000 Server | 3.1 | 9.1 TS1M3 SP4 | ||||
| Microsoft Windows 2000 Professional | 3.1 | 9.1 TS1M3 SP4 | ||||
| Microsoft Windows Server 2003 Datacenter Edition | 3.1 | 9.1 TS1M3 SP4 | ||||
| Microsoft Windows Server 2003 Enterprise Edition | 3.1 | 9.1 TS1M3 SP4 | ||||
| Microsoft Windows Server 2003 Standard Edition | 3.1 | 9.1 TS1M3 SP4 | ||||
| Microsoft Windows XP Professional | 3.1 | 9.1 TS1M3 SP4 | ||||
| Windows Vista | 3.1 | 9.1 TS1M3 SP4 | ||||
| 64-bit Enabled AIX | 3.1 | 9.1 TS1M3 SP4 | ||||
| 64-bit Enabled Solaris | 3.1 | 9.1 TS1M3 SP4 | ||||
| HP-UX IPF | 3.1 | 9.1 TS1M3 SP4 | ||||
| SAS System | SAS Information Map Studio | Microsoft Windows 2000 Advanced Server | 3.1 | 9.1 TS1M3 SP4 | ||
| Microsoft Windows 2000 Datacenter Server | 3.1 | 9.1 TS1M3 SP4 | ||||
| Microsoft Windows 2000 Server | 3.1 | 9.1 TS1M3 SP4 | ||||
| Microsoft Windows 2000 Professional | 3.1 | 9.1 TS1M3 SP4 | ||||
| Microsoft Windows NT Workstation | 3.1 | 9.1 TS1M3 SP4 | ||||
| Microsoft Windows Server 2003 Datacenter Edition | 3.1 | 9.1 TS1M3 SP4 | ||||
| Microsoft Windows Server 2003 Enterprise Edition | 3.1 | 9.1 TS1M3 SP4 | ||||
| Microsoft Windows Server 2003 Standard Edition | 3.1 | 9.1 TS1M3 SP4 | ||||
| Microsoft Windows XP Professional | 3.1 | 9.1 TS1M3 SP4 | ||||
| Windows Vista | 3.1 | 9.1 TS1M3 SP4 | ||||



