Sample 26175: Creating a SAS® Stored Process in SAS® Enterprise Guide® 4.1 that can be associated with a SAS® Information Map
Overview
This sample is going to cover a typical scenario where a user has joined or
manipulated data in SAS Enterprise Guide 4.1. The user then wants to use the process
flow as a basis for a SAS Information Map. This example uses three tables from
the SASHELP library, so you should be able to follow along without having to
create any special tables. The major steps involved are the following:
- Create the SAS stored process in SAS Enterprise Guide.
- Create and register metadata for the result table.
- Modify the stored process to write output to SAS WORK library.
- Create the information map by using the metadata for the result table and the stored process.
Note: This sample applies to SAS Enterprise Guide 4.1 and SAS Information Map Studio 3.1. For information about how to use stored processes with SAS Information Map Studio 4.2 and 4.31, see SAS Sample 39432 .
Create the SAS Stored Process in SAS Enterprise Guide
- Open SAS Enterprise Guide.
- Use the Append task to append SASHELP.PRDSALE, SASHELP.PRDSALE2, and SASHELP.PRDSALE3. Modify the Append task to write the
results to WORK.Sales.
- Right-click inside
the Process Designer window and select Create Stored Process to launch the Create New Stored Process Wizard.
- Enter a name for the stored process, and then click Next. The second page of the wizard displays the stored process code. Click Next without making any changes.
- Choose a location in metadata to store the stored process. The recommended location is
//Foundation/BIP Tree/ReportStudio/Shared/Reports/StoredProcesses
. Click Next.
- On the fourth wizard page, you need to specify a physical location to store the SAS program that you are creating. You might also need to specify the Execution Server or change the server from your stored process server to your logical workspace server. (SAS® Information Map Studio requires that the stored process runs on the workspace server.) To supply this information, click Modify and specify the server and the path.
- On the fifth wizard page, select the check box beside each library that is used in the stored process unless
it is one of the default libraries like SASHELP or WORK. Click Next twice to display the seventh wizard page.
- On the seventh wizard page, select None for the Output Options, then click Next, verify the settings, and click Finish.
- Save the SAS Enterprise Guide project.
Create and Register Metadata for the Result Table
SAS Information Map Studio requires that you insert at least one table into
the map. The table that you insert must match the structure of the result table
in your stored process. In order to accomplish this, we are going to create
a new library and table that represents the structure of the final table.
- Open SAS Management Console.
- Expand the Data Library Manager.
- Right-click on SAS Libraries and select New Library to launch the New Library Wizard.
- Choose SAS Base Engine Library and then click Next.
- On the subsequent wizard pages, enter a name for the library in metadata, supply a libref and physical path, assign the library to the SASMain server, and then click Finish.
- Beneath the Data Library Manager, right-click on the library name and select Display Libname. Copy the LIBNAME statement from the dialog box.
- In the SAS Enterprise Guide project with the stored process flow, double-click on the stored process, and then select SAS Code in the Stored Process Manager dialog box.
- Scroll to the code that creates the final table. In this example, a SQL procedure creates the final table called WORK.SALES. We need to submit a piece of code to create our metadata table.
- Just beneath the Quit; statement, paste the LIBNAME statement that you copied in step 6. Add the following
lines of code beneath the LIBNAME statement:
data biout.Sales;
set Work.Sales (obs=1);
run;
|
- Click the Save and Run button. Check the log to make sure that
the table was created.
- Remove all of your custom code.
- Click the Save and Run button to make sure that the code still
runs as expected.
- In SAS Management Console, right-click on the BIOUT library and select Import Tables to import the Sales table,
- Once registered, the Sales table should show up in the BIOUT library in
SAS Management Console.
Modify the Stored Process to Write Output to the SAS WORK Library
The final preparation steps to the stored process involve changing the library
of the final table to match the library name that we created in the SAS Management
console. In this example, the library is called BIOUT. It is a requirement for
the library name to be the same as the one in metadata that we are going to
reference in SAS Information Map Studio. We also need to change the path to
the BIOUT library.
- From within SAS Enterprise Guide, reopen the stored process and select
SAS Code.
- Scroll to the bottom of the code where the final table is created. In this
example the final table is called WORK.SALES.
- Change the final table to be BIOUT.SALES.
- Just above the PROC SQL statement, type the library that you defined in metadata, but replace the path with
(work)
. It should
look like: libname BIOUT (work);
- Select Save and Run. Look at the log to verify that BIOUT is
now writing to the Work library and that the resulting table, BIOUT.SALES, is being
populated with the correct number of rows.
Create the Information Map By Using the Metadata Table and the Stored Process
- Open SAS Information Map Studio.
- Select Insert→Table.
- Navigate to the BIOUT.SALES table and select OK.
- Click the double arrow to move the SALES table from the Physical Data pane
to the Information Map pane.
- Select Tools→Stored Processes
- Select the Use the selected stored process option, and then select the name of the stored process that you created in SAS Enterprise Guide. Click OK. If the stored process does not show
up in the list then it probably means that you did not configure the stored
process to run on a workspace server.
- Select Tools→Test.
- Move all of the data items from the Available Items list to the Selected Items list.
- Click Run Test. If the results are displayed, then you successfully
applied the stored process to the information map.
Additional Documentation
For a list of available documentation for SAS Enterprise Guide, see http://support.sas.com/documentation/onlinedoc/guide/
For a list of available documentation for SAS Information Map Studio, see http://support.sas.com/documentation/onlinedoc/ims/index.html
For a list of available documentation for SAS Management Console, see http://support.sas.com/documentation/onlinedoc/sasmc/index.html.
For more information about SAS stored processes, see the SAS 9.1.3 Integration Technologies: Developer's Guide at http://support.sas.com/rnd/itech/doc9/dev_guide/stprocess/index.html.
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.
This sample demonstrates how to create a SAS stored process and then associate it with an information map. It is specific to SAS Enterprise Guide 4.1 and SAS Information Map Studio 3.1.
Type: | Sample |
Topic: | Data Management ==> Data Sources ==> Information map Query and Reporting ==> Interactive Querying Query and Reporting
|
Date Modified: | 2008-05-03 18:30:55 |
Date Created: | 2007-08-22 17:40:16 |
Operating System and Release Information
SAS System | SAS Information Map Studio | Microsoft® Windows® for x64 | 3.1 | | 9.1 TS1M3 SP4 | |
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 | |