SAS Web Report Studio does not have a built-in feature that subsets all sections of a report based on prompt values that are entered only once (sometimes called global prompting). For example, if you enter a value for a date prompt in section 1, that value is not used to automatically subset all other sections in the report.
As a solution, this sample presents two small stored processes that you can use to seamlessly pass prompt values to all sections of your report. In this way, all sections are automatically subset by the same criteria. The stored process can even be used to subset other reports.
In addition to knowing how to create a report in SAS Web Report Studio, this sample assumes that you know how to submit SAS code, register a stored process in metadata, and create an information map.
This sample is intended for advanced users.
To illustrate how the stored processes work, this sample explains how to create a prompted report with two sections. The prompts are for year and month. After the year and month are entered, both sections of the report are subset by the specified values.
This solution uses two stored processes:
As the input table for the information map, this sample uses the PRDSALE table, which is one of the sample tables included with SAS. For information about registering libraries and tables, see the SAS 9.2 Intelligence Platform: Data Administration Guide.
SetDate.sas
to your SAS server and note the location. You must know the location in order to register the stored process.
/* ****************************************************************************\
* Program: SetDate.sas
*
* Description: This program prompts the user for year and date and then saves the
* values into wrstemp.<yourid>date table. Macro, GetDates is used to retrieve
* the values from the table. WRSTEMP was chosen just as an example. Any
* library that all users have access to could be used.
*
* Input: Prompt #1 year
* Prompt #2 month
*
*
******************************************************************************* */
*ProcessBody;
%stpbegin;
%global year month;
options symbolgen;
%let _metauser = %scan(%sysfunc(getoption(METAUSER)),1,'@');
data wrstemp.&_metauser.date;
length year month 8;
year = &year;
month = &month;
run;
%stpend;
|
c:/storedprocesses
). SetDate.sas
.Here is what the Parameters tab might look like at this point.
Note: If you are creating the stored process in SAS 9.3, then, in SAS Management Console, right-click on the stored process and select Make Compatible. Using the Make Compatible option is the easiest way to ensure that stored processes created with SAS 9.3 can be used with information maps.
GetDate.sas
to your SAS server and note the location. You must know the location in order to register the stored process.
/* ****************************************************************************
* Program: GetDate.sas
*
* Description: This program grabs the year and date from wrstemp.<userid>date table and
* sets them into two macro variables: year and month.
*
*
******************************************************************************* */
*ProcessBody;
%stpbegin;
%global year month;
%let _metauser = %scan(%sysfunc(getoption(METAUSER)),1,'@');
data _NULL_;
set wrstemp.&_metauser.date;
call symput("year",year);
call symput("month",month);
run;
data _NULL_;
put "Year= &year";
put "month= &month";
run;
%stpend;
|
GetDate.sas
, follow steps 2 through 8 in the previous section, skipping step 7. This stored process does not include parameters. Note: If you are creating the stored process in SAS 9.3, then, in SAS Management Console, right-click on the stored process and select Make Compatible. Using the Make Compatible option is the easiest way to ensure that stored processes created with SAS 9.3 can be used with information maps.
month(<<prdsale.month>>)
. Then, on the Classifications, Aggregations, Formats tab, change the Format Type to Numeric. &year
. Click OK to acknowledge the warning message that appears.&month
. Click OK to acknowledge the warning message that appears.This is what your filter should look like at this point.
From the Table of Contents, select Section1, and then click the View tab. When you are prompted for a year and month, accept the defaults or enter new values, then click View Report. Results in both report sections should be subset by the values that you entered.
Figure 1. Stored process prompts appear
Figure 2. Section1 displays results for March 1993
Figure 3. Section2 is automatically subset by March 1993
For more information about stored processes, see SAS 9.2 Stored Processes: Developer's Guide.
For more information about SAS Management Console, see the SAS Management Console documentation page.
For more information about SAS Information Map Studio, see the SAS Information Map Studio documentation page.
For more information about SAS Web Report Studio, see the SAS Web Report Studio documentation page.
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 |
Topic: | Query and Reporting ==> Interactive Querying |
Date Modified: | 2010-09-07 14:09:08 |
Date Created: | 2010-09-01 11:34:35 |
Product Family | Product | Host | Product Release | SAS Release | ||
Starting | Ending | Starting | Ending | |||
SAS System | SAS Web Report Studio | Microsoft® Windows® for x64 | 4.2 | 9.2 TS2M0 | ||
Microsoft Windows Server 2003 Datacenter Edition | 4.2 | 9.2 TS2M0 | ||||
Microsoft Windows Server 2003 Enterprise Edition | 4.2 | 9.2 TS2M0 | ||||
Microsoft Windows Server 2003 Standard Edition | 4.2 | 9.2 TS2M0 | ||||
Microsoft Windows Server 2003 for x64 | 4.2 | 9.2 TS2M0 | ||||
Microsoft Windows Server 2008 for x64 | 4.2 | 9.2 TS2M0 | ||||
Microsoft Windows XP Professional | 4.2 | 9.2 TS2M0 | ||||
Windows Vista | 4.2 | 9.2 TS2M0 | ||||
Windows Vista for x64 | 4.2 | 9.2 TS2M0 | ||||
64-bit Enabled AIX | 4.2 | 9.2 TS2M0 | ||||
64-bit Enabled Solaris | 4.2 | 9.2 TS2M0 | ||||
HP-UX IPF | 4.2 | 9.2 TS2M0 | ||||
Linux for x64 | 4.2 | 9.2 TS2M0 | ||||
Solaris for x64 | 4.2 | 9.2 TS2M0 |