SAS 9.1.3 Integration Technologies » Developer's Guide

SAS Stored Processes
Software Requirements
Creating Stored Processes
Input Parameters
Result Types
Reserved Macro Variables
Stored Process Server Functions
Converting SAS/IntrNet Programs
Using Stored Processes
Building a Web Application
SAS Stored Process Web Application
HTTP Headers
Embedding Graphics
Chaining Stored Processes
Using Sessions
IOM Direct Interface Stored Processes
SAS Stored Processes

Result Types

A stored process is a SAS program and can produce any kind of output that a valid SAS program can produce. Output could include data sets, external files, e-mail messages, SAS catalogs, packages, and many other objects. In some cases, output (or a "result") is delivered to the client application executing the stored process. In other cases, the output is generated only on the server. When creating a stored process, you must describe any output that is returned to the client. There are four types of client output.

  • The simplest result type is None. The client receives no output from the stored process. The stored process is still able to create or update data sets, external files or other objects, but this output remains on the server. This result type is indicated by the input parameter _RESULT set to STATUS, because only the program status is returned to the client.

  • Streaming output delivers a data stream, such as an HTML page or XML document, to the client. This result type is indicated by _RESULT set to STREAM. The data stream can be textual or binary data and is visible to the stored process program as the _WEBOUT fileref. Any data written to the _WEBOUT fileref is streamed back to the client application. Streaming output is supported only on the stored process server. Stored processes executing on a workspace server cannot use streaming output.

  • Transient package output returns a temporary package to the client. The package can contain multiple entries, including SAS data sets, HTML files, image files, or any other text or binary files. The package exists only as long as the client is connected to the server. This result type is a convenient way to deliver multiple output objects (such as an HTML page with associated GIF or PNG images) to a client application. Transient package output is available on both stored process and workspace servers, but the implementations differ. On the stored process server, transient package output is indicated by _RESULT set to PACKAGE_TO_ARCHIVE and the input parameter _ARCHIVE_PATH set to TEMPFILE. On the workspace server, transient package output is indicated by _RESULT set to PACKAGE_TO_REQUESTER.

  • Permanent package output creates a package in a permanent location on a WebDAV server or in the server file system. The package is immediately accessible to the stored process client, but is also permanently accessible to any client with access to WebDAV or the server file system. This result type is a convenient way to publish output for permanent access.

    Output to WebDAV is indicated by _RESULT set to PACKAGE_TO_WEBDAV. The input parameter _COLLECTION_URL contains the target location. The input parameters _HTTP_USER and _HTTP_PASSWORD might be set if the WebDAV server is secured and credentials are available. _HTTP_PROXY_URL is set if an HTTP proxy server is required to access the WebDAV server. Output to the server file system is indicated by _RESULT set to PACKAGE_TO_ARCHIVE. The input parameters _ARCHIVE_PATH and _ARCHIVE_NAME contain the target repository and filename, respectively.

Note that although the result type is chosen when you define a stored process, the result type can be changed by the client application through calls to the Stored Process Service API. Where possible, it is recommended that you write stored processes to support any appropriate client result type. This enables a client application to select the result type most appropriate for that application. The program can determine the desired client result type by examining the _RESULT input parameter. The %STPBEGIN and %STPEND macros include support for any of the four result types. The following stored process is capable of generating streaming, transient package, or permanent package output. (It can also be run with _RESULT set to STATUS, but this would produce no useful result.)

   proc print data=SASHELP.CLASS noobs;
      var name age height;

The input parameters mentioned previously are set by the stored process client APIs and are reserved parameters. They cannot be overridden by passing in new values through the normal parameter interface. Special API methods are provided to set the result type and associated parameters for a stored process. See Reserved Macro Variables for more information about specific input parameters.