SAS Stored Processes
Creating Stored Processes
A stored process is a SAS program that is hosted on a server and described by metadata. Stored processes can be written by anyone who is familiar with the SAS programming language or with the aid of a SAS code generator such as SAS Enterprise Guide. The basic steps to creating a stored process are as follows:
Almost any SAS program can be a stored process. A stored process can be written using the SAS program editor, SAS Enterprise Guide, or any text editor. The following program is a typical stored process:
*ProcessBody; %stpbegin; title "Shoe Sales By Region and Product"; footnote; proc report data=sashelp.shoes nowindows; column region product sales; define region / group; define product / group; define sales / analysis sum; break after region / ol summarize suppress skip; run; %stpend;
The program begins with a standard comment that initiates input parameter processing, if any. The
Note: You should not use the
You must choose a server to host your stored process. Servers are defined in metadata and are actually logical server definitions that can represent one or more physical server processes. There are many options including pre-started servers, servers started on demand, and servers distributed across multiple hardware systems. You can use the Server Manager in SAS Management Console to create or modify server definitions. For more information about server configurations, see SAS Integration Technologies: Server Administrator's Guide.
Because the logical server description in metadata hides the server implementation details, a stored process can be moved to or associated with any appropriate server without modifying the stored process. Moving a stored process from one server to another requires only changing the metadata association and moving the source code if necessary. Note that a stored process is the combination of a SAS program, the server that hosts that program, and the metadata that describes and associates the two. It is not possible to create a stored process that is associated with more than one server, although it is possible to create stored processes that share the same SAS program, or source code file.
Stored processes can be hosted by two types of servers: SAS Stored Process Servers and SAS Workspace Servers. The two servers are similar, but have different capabilities and are targeted at different use cases.
Stored Process Server
The stored process server is a multi-user server. A single server process can be shared by many clients. The recommended load-balancing configuration enables client requests to be serviced by multiple server processes across one or more hardware systems. This approach provides a high-performance, scalable server, but imposes some restrictions. Because the same server handles requests from multiple users, it cannot easily impersonate that user to perform security checks. By default, the server runs under a single, shared user identity (defined in metadata) for all requests. All security checks based on client identity must be performed in the stored process. For more information about stored process server security, refer to the section about Planning Security on Workspace and Stored Process Servers.
The stored process server implements several features that are not available on the workspace server, including streaming output, sessions, and multiple-value input parameters. Stored process Web services are only supported on the stored process server.
The workspace server is a single-user server. A new server process is started for each client. This approach is not as scalable as the load-balanced stored process server, but it has a major security advantage. Each server is started under the client user identity and is subject to host operating environment permissions and rights for that client user. The workspace server also provides additional functionality, including data access and execution of client-submitted SAS code. For more information about workspace server security, refer to the section about Planning Security on Workspace and Stored Process Servers.
Some features available on the stored process server are not available on the workspace server, as described in the previous section. Information map stored processes are supported only on the workspace server.
Using Source Code Repositories
Stored processes are stored in external files with a
For z/OS, the program can be contained in an HFS
After you write the stored process and define or choose a server, you must register the metadata using BI Manager. (SAS Enterprise Guide users can perform the same steps within the Enterprise Guide application.) The New Stored Process Wizard can be used to create new stored processes, or you can use the Stored Process Properties dialog box in BI Manager to modify existing stored processes. BI Manager enables you to specify and manage the following information for stored processes:
You are now ready to use the stored process from a variety of clients including the SAS Stored Process Web Application, the SAS Information Delivery Portal, the SAS Add-In for Microsoft Office, SAS Enterprise Guide, and user-written Java applications and JSPs.