Understanding and Writing SASĀ® Stored Process

A stored process is just like a SASĀ® program, can be base SAS or advanced SAS code, stored in a central server with necessary metadata. It can be executed as required by requesting applications. It can be stored centrally on a server so that they may be accessed from anywhere in the organization. It is hosted on a server and described by metadata. We can use stored processes for Web reporting, analytics, building Web applications, delivering packages to clients or to the middle tier, and publishing results to channels or repositories. A stored process can be invoked easily from central location by many of the SAS clients at a same time like SAS EG, SAS ID, SAS BI Dashboard, SAS Web Report Studio.

Advantages

The main advantage of Stored Processes is its ability to centrally maintain and manage SAS code. For example, code is not embedded in client applications; it is stored on a server. This enables us to centrally maintain, manage, and secure the code. Another advantage is that stored processes can be invoked from multiple types of clients such as Web browsers and desktop applications. Because there is only one copy of the code, every client application that invokes a stored process always gets the latest version of the stored process program. Ā Itā€™s important to note however that, we must use a SAS Metadata Server to administer SAS Stored Processes. To make a stored process accessible to client applications, we must allocate a storage location that your server can access. Then, use BI Manager to create metadata that describes the stored process and its location. BI Manager stores this metadata on the SAS Metadata Server so that it can be accessed by client applications.

SP Programming Environment

SAS windowing environment (or a text editor) as your programming environment or SAS Enterprise Guide can be used to create a SAS stored process, although there are several other ways as well to create and register a stored process. We can also use the New Stored Process wizard in SAS Management Console to register the metadata for our program. If we are using SAS Enterprise Guide, then the metadata registration is included in the Create New SAS Stored Process wizard. A SAS stored process is versatile because of the underlying metadata and security support. SAS Enterprise Guide is an easy-to-use Windows application that provides an intuitive visual interface to the power of SAS and the ability to easily export data to other applications. Stored processes can also access any SAS data source or external file and create new data sets, files, or other data targets supported by SAS.

The ability to store your SAS programs on the server provides an effective method for change control management. For example, instead of embedding the SAS code into client applications, we can centrally maintain and manage this code from the server. This gives us the ability to change your SAS programs and at the same time ensure that every client that invokes a stored process will always get the latest version available.

Types of SAS Stored Process

In SAS version 8,Ā IOM (Integrated Object Model) Direct Interface Stored Processes was introduced. This type of stored process operates on a SAS Workspace Server and produces packages only. SAS Stored Processes are newly introduced with SAS Integration Technologies 9, and they can be used with either a SAS Workspace Server or a SAS Stored Process Server.
Writing a SAS Stored Process

There are three basic steps to creating a stored process:

Write the SAS stored process program either from scratch (using a program editor) or by taking the output of a SAS task. Write the SAS code with the SP process body, having %STPBEGIN in beginning and %STPEND at the end. The %STPBEGIN and %STPEND macros generate ODS statements for us based on the values of reserved macro variables which specify the beginning and ending of a stored process in SAS file. The SAS code in between these ODS statement, will be run once the SP is executed. The program begins with theĀ %STPBEGIN and %STPEND macrosĀ to initialize the Output Delivery System (ODS) and deliver the output to the client. This stored process is capable of generating multiple output formats, like HTML, XML, PDF, CSV.

1. Choose or define a server for running the SAS SP in SAS Enterprise Guide.
2. Register the stored process metadata.

After a stored process has been created and registered, it can be invoked from several of the SASĀ® 9 Intelligence Platform applications, such as SAS Enterprise Guide, SAS Add-In for Microsoft Office, SAS Information Map Studio, SAS Web Report Studio, and the SAS Information Delivery Portal. SAS stored processes can be hosted by either the SAS Stored Process Server or the SAS Workspace Server.
In conclusion, we can say that the combination of SAS Program and SAS Metadata gives us SAS Stored Process. The stored process concept becomes even more powerful when we consider that these SAS programs can be invoked from multiple client contexts. Using SAS SP also enhances security and application integrity because the programs that access your sensitive data are contained on the server instead of being widely distributed with the client applications.


Related Articles for Further Reading

All About SASĀ® OnDemand

Is SASĀ® Still a Leader in Analytics?

Top 8 Reasons to Learn SAS

Related Articles

loader
Please wait while your application is being created.
Request Callback