Wednesday, July 13, 2011

New SAS Log and Logging Features in SAS 9.3

First things first — what’s new in the SAS log? The log in SAS 9.3 is basically the same as what we have seen since SAS 7, but there is one new feature of note.

The RESETLINE statement, a global statement, resets the program line numbers that appear with program lines in the log. The RESETLINE statement does not affect the line number of the program line it appears on, but the line numbers start over at 1 beginning with the next program line. You might use the RESETLINE statement at the beginning of a SAS program so that the program lines in the log correspond to specific places in the program. Another place where you might use the RESETLINE statement is at the end of an autoexec file.

Separately, there are extensive changes in the logging facility. It was introduced in SAS 9.2 but comes into its own in SAS 9.3. The logging facility is a cleaner way to generate log messages and deliver them, not particularly to the SAS log, but to external destinations that now may include “third-party databases and Java classes.” A log event indicates a logger (category), along with a log message (text) and a message level (or threshold), such as info or error. You can use functions, component objects, or macro language to create log events. Filters in the logging facility determine which messages go to which destinations.

SAS programs have always been able to write text in the log as a message. The idea here, though, is to have an object-oriented approach to messages so that selected messages can be delivered in particular ways. This could include adding messages to web pages along with the program’s results. Apparently it could also include triggering system-level scripts that respond to specific events or problems that may occur in the execution of a SAS program. As an example, a logging event could result in a SAS program being rerun later if the program fails because of a certain kind of database error. It’s easy to imagine a program for which you would want this to happen automatically, instead of having a person note the failure, read the SAS log, identify the point of failure, and manually relaunch the SAS program.

No comments:

Post a Comment