SUPPORT / SAMPLES & SAS NOTES
 

Support

Sample 26175: Creating a SAS® Stored Process in SAS® Enterprise Guide® 4.1 that can be associated with a SAS® Information Map

DetailsAboutRate It

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

  1. Open SAS Enterprise Guide.
  2. Use the Append task to append SASHELP.PRDSALE, SASHELP.PRDSALE2, and SASHELP.PRDSALE3. Modify the Append task to write the results to WORK.Sales.
  3. Process Flow

  4. Right-click inside the Process Designer window and select Create Stored Process to launch the Create New Stored Process Wizard.
  5. 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.
  6. Choose a location in metadata to store the stored process. The recommended location is //Foundation/BIP Tree/ReportStudio/Shared/Reports/StoredProcesses. Click Next.
  7. image label

  8. 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.
  9. image label

  10. 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.
  11. image label

  12. On the seventh wizard page, select None for the Output Options, then click Next, verify the settings, and click Finish.
  13. 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.

  1. Open SAS Management Console.
  2. Expand the Data Library Manager.
  3. Right-click on SAS Libraries and select New Library to launch the New Library Wizard.
  4. image label

  5. Choose SAS Base Engine Library and then click Next.
  6. image label

  7. 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.
  8. Beneath the Data Library Manager, right-click on the library name and select Display Libname. Copy the LIBNAME statement from the dialog box.
  9. image label

  10. 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.
  11. image label

  12. 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.
  13. 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:
  14. data biout.Sales;
      set Work.Sales (obs=1);
    run;
    

    image label

  15. Click the Save and Run button. Check the log to make sure that the table was created.
  16. image label

  17. Remove all of your custom code.
  18. Click the Save and Run button to make sure that the code still runs as expected.
  19. In SAS Management Console, right-click on the BIOUT library and select Import Tables to import the Sales table,
  20. image label

  21. Once registered, the Sales table should show up in the BIOUT library in SAS Management Console.
  22. image label

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.

  1. From within SAS Enterprise Guide, reopen the stored process and select SAS Code.
  2. Scroll to the bottom of the code where the final table is created. In this example the final table is called WORK.SALES.
  3. Change the final table to be BIOUT.SALES.
  4. 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);

    image label

  5. 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.
  6. image label

Create the Information Map By Using the Metadata Table and the Stored Process

  1. Open SAS Information Map Studio.
  2. Select Insert→Table.
  3. Navigate to the BIOUT.SALES table and select OK.
  4. Click the double arrow to move the SALES table from the Physical Data pane to the Information Map pane.
  5. image label

  6. Select Tools→Stored Processes
  7. image label

  8. 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.
  9. image label

  10. Select Tools→Test.
  11. Move all of the data items from the Available Items list to the Selected Items list.
  12. image label

  13. Click Run Test. If the results are displayed, then you successfully applied the stored process to the information map.
  14. image label

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.