STP Procedure

Example: Generating an ODS Document File

Features:
PROC STP statement options:
PROGRAM=
ODSOUT=

PROC DOCUMENT statement options: NAME=

REPLAY statement

Other features:
System options:
METASERVER
METAPORT
METAUSER
METAPASS

ODS _ALL_ CLOSE statement

ODS HTML statement

GOPTIONS statement

ODS destinations: DOCUMENT

HTML

Details

This sample code is intended to be executed in an interactive or batch SAS session. You need to specify metadata connection information so that your SAS session connects to the metadata server that contains the "Cholesterol by Sex and Age Group" stored process sample.
Starting with SAS 9.3, stored process source code can be stored on the SAS Metadata Server. The SAS source code for this stored process is stored in metadata. If you use PROC STP to execute a stored process that has the SAS source code stored on the file system, that file location must be accessible to the interactive/batch session.

Program

ods _all_ close;
options metaserver = 'your-metadata-server'
        metaport   =  your-metadata-server-port
        metauser   = 'your-userid'
        metapass   = 'your-password';
proc stp program='/Products/SAS Intelligence Platform/Samples/
   Sample: Cholesterol by Sex and Age Group'
odsout=store;
run;
goptions device=png;
ods html path='your-output-directory' file='test.htm' style=HTMLBlue;
  proc document name=&_ODSDOC (read);
    replay / levels=all;
  run;
ods html close;

Program Description

Close all open ODS destinations.The ODS _ALL_ CLOSE statements closes all open destinations.
ods _all_ close;
Provide connection information to the metadata server where the stored process is registered.The METASERVER= option specifies the host name or address of the metadata server, the METAPORT= option specifies the TCP port for the metadata server, the METAUSER= option specifies the user ID for connecting to the metadata server, and the METAPASS= option specifies the password for the metadata server.
options metaserver = 'your-metadata-server'
        metaport   =  your-metadata-server-port
        metauser   = 'your-userid'
        metapass   = 'your-password';
Execute the stored process and generate a destination- and device-independent ODS Document file. The two-level name of the ODS Document file is stored in the _ODSDOC reserved macro variable, and this document is replayed using the DOCUMENT procedure. The stored process source code is stored in metadata.
proc stp program='/Products/SAS Intelligence Platform/Samples/
   Sample: Cholesterol by Sex and Age Group'
odsout=store;
run;
Specify the graphics device for the output.The GOPTIONS DEVICE=PNG statement specifies PNG as the graphics device.
goptions device=png;
Use PROC DOCUMENT to create an HTML file containing the output of the stored process.The ODS HTML statement creates your file in your directory and applies the HTMLBlue style. The DOCUMENT procedure replays the stored process output. For more information about PROC DOCUMENT, see The DOCUMENT Procedure in SAS Output Delivery System: User's Guide.
ods html path='your-output-directory' file='test.htm' style=HTMLBlue;
  proc document name=&_ODSDOC (read);
    replay / levels=all;
  run;
Close the HTML destination and then view the HTML file using a Web browser.
ods html close;