All the possible uses for PROC STP

4

PROC STP is a new procedure for SAS 9.3 Stored Processes. It's so new and different that I have not had the opportunity to use it yet in a customer engagement. When writing about it for the now released "The 50 Keys to Learning SAS Stored Processes" book, I had to dream up several good examples.

But to dream up possible uses, understanding what this new fangled thing can and cannot do was of the utmost importance. Single and multiple parameters can be passed into the procedure using the INPUTPARAM statement. Data from the stored process could be returned into the current session using the OUTPUTDATA statement. Add the REPLAY option to immediately see the ODS output in your client session, or store it and use PROC DOCUMENT to push the content to a permanent location. Here is an example of this trick in action.

Most importantly, the STP Procedure retrieves the .sas code and runs in the client session. So for BASE SAS users, if the .sas code is not in a shared (and identically mapped) location in the client and the server systems, the client session will not be able to locate the code to run. Wait, remember the discussion about 9.3 allowing sas code to be stored in the metadata directly? I venture that this eliminates the constraints of storing the .sas files in shared & identically mapped locations. Otherwise, SAS Enterprise Guide could act as the interface by running the PROC STP on the server directly.

After knowing all of this, here are a couple of my ideas.

  1. Grabbing the resulting data from a stored process for further analysis in my local session
  2. Retrieving the ODS output from one or more stored processes (during a monthly batch process) to include everything together into a single Monthly Report
  3. Using the procedure within another stored process, similar to chaining, to reduce/reuse/recycle existing code.

What other uses do you see for PROC STP? What are you looking forward to trying?
For more examples on using PROC STP, check out the last chapter of my new book, co-authored with Tricia Aanderud, "The 50 Keys to Learning SAS Stored Processes". Buy it today or register by 10PM, Monday April 16th to win a free copy!

Share

About Author

Angela Hall

Senior Technical Architect

Angela offers tips on using the SAS Business Intelligence solutions. She manages a team of SAS Fraud Framework implementers within the SAS Solutions On-Demand organization. Angela also has co-written two books, 'Building BI using SAS, Content Development Examples' & 'The 50 Keys to Learning SAS Stored Processes'.

Related Posts

4 Comments

  1. Using 'proc STP', can a called SAS stored process bind to a DBMS stored procedure, which returns a 'result set'.

    • Angela Hall

      Hi Dan!
      If a SAS program can run the DBMS stored process (through a PROC SQL statement) and return a result, then you can also do the same by placing this code in a SAS Stored Process and using Proc STP to run that SAS stored process.
      A couple of caveats to this - the Proc STP should be run from the same machine as the SAS Object Spawner & the Proc SQL statement within the SAS Stored Process should be modified to use the Proc STP output table parameter macro rather than a 'regular' table name. And this output table parameter should have a defined default value in the SAS Metadata for this SAS Stored Process so that the process will run from other applications, not just Proc STP.

      In my most recent book, the 50 Keys to Learning SAS Stored Processes, I have an entire chapter for Proc STP. More information on these output table and result parameters is covered there.

  2. Bruno Mueller on

    I think the biggest misunderstanding with Proc STP is, that the code is not run as an STP, but rather the code behind the STP is executed.

    • Angela Hall

      Agreed. This functionality is different than the PROC HTTP call which could be used to request stored process results from the web application. PROC STP acts as a call to only the metadata & then pulls that information (sas code, parameters, etc) into the local client session for execution.

Back to Top