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

Debugging Stored Processes

There are two techniques for debugging stored processes:

Examining the SAS Log

The client interfaces provided to stored processes usually include a mechanism for retrieving the SAS log from a stored process. For example, passing an input parameter _DEBUG=LOG to the SAS Stored Process Web Application causes the SAS log to be returned with the stored process output. The SAS log is directly accessible from the Stored Process Service API. Assuming your installation is configured correctly, most run-time stored process errors will appear in the SAS log.

If you are unable to access the SAS log from the client interface, you might be able to access the SAS log from the server log files. The server administrator controls the level of server logging enabled and the location of the server log files. Server log options vary depending on the server type.

The stored process server enables you to capture the SAS log for each stored process in the server log with the APPLEVEL option. The APPLEVEL option can be specified in the Object Server Parameters field in the Server Manager definition for the server in SAS Management Console. The following table describes the supported values for the APPLEVEL option:

APPLEVEL Value Logging Behavior
0 Summary. The stored process server only logs an identifying build statement and error conditions.
1 Default. The stored process server logs APPLEVEL=0 messages, minimal processing statements, as well as the SAS log for each stored process that completes with an error status.
2 Full. The stored process server logs APPLEVEL=1 messages, except that the SAS log is included for every stored process executed on the server.
3 Debug. The stored process server logs verbose processing statements as well as the APPLEVEL=2 messages. Not recommended except for special debugging circumstances.

The workspace server also supports the APPLEVEL option, but does not log the same information. The logging behavior in the previous table is supported only by the stored process server. Client-side access is generally recommended for the SAS log. The IOMLEVEL=2 option can be enabled in cases where debugging must be performed from server logs, but this option is not recommended for production servers. The log output with this option is very verbose and might affect server performance.

Using SAS Options

There are several SAS options that can help you debug problems in your stored processes. If you can return the SAS log to your browser, activating some of these options can make that log more useful. If you are debugging a stored process that contains macro code, you should supply one or more of these options at the beginning of your stored process: MPRINT, SYMBOLGEN, MLOGIC, MERROR.

If, for security reasons, you have disabled the display of submitted source code in your stored process using the NOSOURCE option when you are debugging, you should enable this feature by supplying the SOURCE option. You can then see your submitted SAS code in the log that is returned to your browser. After you are finished debugging, you can revert to using NOSOURCE if your security model requires it.