Using the SAS Stored Process Manager - SAS BI

 

Stored Process Manager

Sas Enterprise Guide provides a wizard named the Stored Process Manager that guides the user through the steps of creating a stored process.
The wizard automatically

  • adds the %STPBEGIN and %STPEND statements
  • saves the code in the stored process code repository
  • registers the stored process in the metadata repository.

SAS Enterprise Guide is the preferred way to develop and test stored processes in SAS®9 because, you can create and test the program in one application.
Stored processes can be created from a variety of sources, including

  • tasks that have been added to the project
  • existing SAS programs.

SAS Enterprise Guide uses the Create New Stored Process Wizard.

Stored Process Wizard.

Using the Stored Process Manager

This demonstration shows how to create, register and run stored processes using SAS Enterprise Guide.

Using the Stored Process Manager

Right-click on One-Way Frequencies task in the Process Flow window and select Create Stored Process….
In Step 1 of the wizard, accept the default name and enter a description and keywords (if desired).
Creating Stored Process

3. In Step 2, select the repository on the metadata server to store the stored process metadata item.
4. Expand the Foundation repository, and select the Training group:

Select Ok Button

New Stored Process Wizard

Select Next
5. In Step 3, set the Execution server to SASMain – Logical Stored Process Server – SAS Stored Process Server – 9.1.
6. Select the Source file path

Source Path
7. Accept the default source filename (this is the file that is being created for you by the SAS Enterprise Guide Stored Process Wizard).

Stored Process Wizard

Select Next
8. Accept the defaults in Step 4.

Stored Process Wizard

This window shows the LIBNAME statement that will be added to the new program in order to access the source table. By default, these are set up using the Metadata Libname Engine.

Select Next Button
9. Accept the defaults in Step 5 since this stored process has no parameters.

Stored Process Wizard

If parameters were needed to run this stored process, they would be added in this step.

Select Next
10. Step 6 allows you to choose how the output will be packaged. Select Streaming output, since the results of this stored process will be streamed back to the application that is was called from.

Stored Process Wizard

Select Next
11. In Step 7, verify that the information is correct:

Stored Process Wizard

Select Finish
12. A message window displays indicating the stored process was successfully saved:

Stored Process Wizard

Select Ok Button
13. The stored process is now part of the project:

Process Flow

14. Open the Stored Process List window to see this new stored process by selecting View ÐStored Process List.

Stored Process List

MindMajix Youtube Channel

Create a Stored Process from an Existing Program

The Stored Process Manager in SAS Enterprise Guide can be used to create a stored processes from existing SAS code. The wizard will scan the code for macro variables and lead you through a process of creating parameters from them. This greatly simplifies the process of creating stored processes from legacy code. To begin, add the existing program to the project.
15. Select File Ð Open Ð From My Computer….
16. Navigate to C:Workshopwinsassbiovr and select customerlist.sas:
Select Open. The code is displayed and added to the

Process Flow

17. Remove %let num=20; from the code.
18. Right-click on this new code node and select Create Stored Process. The Stored Process Wizard opens.
19. In Step 1, accept the default Name and specify a Description of Generated by Enterprise Guide.

                                      Checkout SAS BI Interview Questions

New Stored Process Wizard

Select Next
20. In Step 2, verify that the location is //Foundation/Training and select Next

New Stored Process Wizard

21. In Step 3, verify that the execution server is SASMain – Logical Stored Process Server – SAS Stored Process Server – 1, the source file path is Execution Server 

accept the default source filename and select Next

New Stored Process Wizard

22. In step 4, the wizard can help build parameters based on macro variables in the code.
       a. Select Add then Parameters from SAS Code.
       b. Change the text of User prompt to Number of Records.
       c. Select Integer as the Data type.
d. Enter a Default Value of 10.
e. Select the Required Option.

Add Parameters

f. Select the Constraints tab to limit the possible choices for this parameter.

  1. Select Integer range as the type of constraint.
  2. Click the boxes to provide values for the Minimum, Maximum, and Increment options.
  3. Set the value of Minimum to 1.
  4. Set the value of Maximum to 10000.
  5. Set the value of Increment to 5.

Add Parameters

Select Add
g. This parameter is saved and a message window opens, notifying you that no additional macro variables have been located in the code:

Enterprise Guide

Select OK
The information about the num parameter is displayed:

New Stored Process Wizard

Select Next
23. For Step 5, verify that Streaming output is selected, then choose Next

New Stored Process Wizard

24. For Step 6, review the settings and select Finish

New Stored Process Wizard

25. A confirmation window appears:

Stored Process Wizard Success

Select Ok
26. A message may appear:

SAS Enterprise Guide

Select Yes to update the code task.
27. The new stored process has been added to the project and the Stored Process List window.

Stored Process List

28. In the Process Flow window, right-click on the new stored process and select Run this Stored Process.

Process Flow

29. A dialog window opens requesting a value for the parameter num. Enter 8 then select 

Stored Process

30. The HTML report appears:

HTML Report

 

About Author

Vinod M is a Big data expert writer at Mindmajix and contributes in-depth articles on various Big Data Technologies. He also has experience in writing for Docker, Hadoop, Microservices, Commvault, and few BI tools. You can be in touch with him via LinkedIn and Twitter.

read less
  1. Share:
SAS BI Articles