BI Tools

Tips and tricks for building information maps, OLAP cubes, reports, and dashboards

BI Admin

Learn your way around a SAS BI installation.

Visual Analytics

Learn your way around the SAS Visual Analytics tool

Coding & Data

Extract, transform, and load your data into the SAS BI toolset

Stored Processes

Create and design stored processes like a rock star

Home » Stored Processes

Stored Process Outputs Data without a Report

Submitted by on 2011-11-07 – 7:31 AM 2 Comments

You can do more with SAS Stored Processes than just create reports.  These little suckers are packed full of power and the only limit is your imagination (and libraries where you  have write access!)  In this post, you will learn how to use a stored process to move a dataset to another library and not output a report at all.  

 Creating the Stored Process

The stored process prompts the user for the library location and writes the SASHELP.AIR to the dataset.  This example is simple so you can understand the steps of creating a stored process that only outputs data.

Step 1: Register the stored process

Register a stored process from SAS Enterprise Guide or SAS Management Console. sas stored processes

Step 2: Add the SAS Code

The code in this stored process uses a prompt to ask the user where they want to store the SASHELP.AIR dataset. The prompt uses the &LIBNAME variable. I’m adding a field to the dataset so when the results are shown – you can see that the change was made.

%STPBEGIN/%STPEND are used to add the ODS HTML code (basically).  You can decide if you want to include them or not. Since there is no output they are not needed.  My observation is if you uncheck it, the wizard reminds you that it is unchecked every time you go to make a change, so it’s annoying more than anything. sas stored process wizard add code

Step 3: Determine where the stored process will run

You can use the stored process or workspace server.  Notice that since there are not any results you can leave the SAS Result Types check boxes empty.

Step 4: Create the prompt

Add a LIBNAME prompt to ask the user where they want to place the data.  This is prompt is required, so I checked the Requires a non-blank value.

Note: Users must have write permission to the library they choose.

Step 5: Save the Stored Process and Run It

The stored process prompts the user to set the library.

The AIR2 dataset is now available from the Candy library.

SAS BI Test the Stored Process

What about the SAS STP Web Application?

You can also run this stored process from SAS STP Web Application.  In this example I will push the dataset to a different library called EGHelp. When the stored process runs – nothing appears to happen.  However, when you look from SAS Enterprise Guide you can see that AIR2 was moved.

running from sas web application server


Learn More about SAS Stored Processes and Prompts

You can learn more tips and tricks for creating, debugging, and using SAS stored processes in the 50 Keys to Learning SAS Stored Processes book. It's a complete guide to SAS stored processes. Check Amazon for best pricing and quick shipping!

The following two tabs change content below.

Tricia Aanderud

Director of Data Visualization at Zencos Consulting
Tricia Aanderud is a SAS Business Intelligence and Visual Analytics consultant based in Raleigh, NC who works for Zencos Consulting. She has written several books about SAS, presented papers at many SAS conferences, and has been using SAS since 2001. Contact her for assistance with your next project.
Spread the love

Tags: , ,

2 Comments »

  • Tricia says:

    Harsh:
    I think I should give you a prize for coming up with good blog topic ideas!

    I think if you were to create a Group prompt – you could give the user the choice of destination (_odsDest) or data set. I’m thinking the issue will be the result type – since one will require it and the other will not. Hmm …

    Tricia

  • Harsh Gajjar says:

    Really helpful especially the data library prompt … But I would be really eager to use stored process and ask the user about the Output format..

    such an example of stored Process would be really Worth… saving ..

    Secondly I also tried for giving option like PDF,HTML,RTF .. but never tried to give an option between dataset or list report..

1 Pingbacks »