A stored process
is a SAS program that can produce any type 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, the output (or a result) is delivered to the client
application that is executing the stored process. In other cases,
the output is generated only on the server.
When you
register the stored process, you can specify what type of output the
stored process can produce. You can specify
Stream
,
Package
, both output types, or neither
output type.
When you run the stored
process, the client application chooses the type of output that it
prefers. For example, when SAS Web Report Studio runs a stored process,
package output is produced. There are four types of client output:
-
The simplest type of output, or
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 when
the input parameter _RESULT is 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 when _RESULT is 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 that is written to the _WEBOUT fileref is streamed back to
the client application.
-
Package output can be either transient,
meaning that the output is returned only to the client and exists
only in the current session, or permanent, meaning that the package
is stored or published somewhere and can be accessed even after the
session ends.
-
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 indicated when
_RESULT is set to
PACKAGE_TO_ARCHIVE
and
the input parameter _ARCHIVE_PATH is set to
TEMPFILE
.
-
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 when
_RESULT is 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. The _HTTP_PROXY_URL
parameter is set if an HTTP proxy server is required to access the
WebDAV server. Output to the server file system is indicated when
_RESULT is set to
PACKAGE_TO_ARCHIVE
. The
input parameters _ARCHIVE_PATH and _ARCHIVE_NAME contain the target
repository and filename, respectively.
Permanent package output
can also be published to a channel, an e-mail recipient, or to SharePoint.
For more information about the parameters that are used
for publishing packages, see Advanced Package Publishing.
Note: 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.
For more information,
see Using the %STPBEGIN and %STPEND Macros. 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.)
%stpbegin;
proc print data=SASHELP.CLASS noobs;
var name age height;
run;
%stpend;
The input parameters
that were 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.
For more
information about specific input parameters, see Using Reserved Macro Variables. For more information about developing stored processes that
product package results, see Developing Stored Processes with Package Results .