Here are some initial thoughts on how to use the information available in your log to validate your programs and guide end users in using them.
Depending on the interface you use to run your SAS programs, you have varying degrees of functionality for identifying potential issues in your log.
Scrolling through the log to identify critical messages is a manual process that is not 100% reliable. Furthermore, it is tedious. This means that the check will be performed from time to time, rather than every time the program runs.
It might be worth creating your own tool to verify messages.
What kinds of messages are we talking about?
Traditional Messages
By default, SAS systems generate three types of messages: ERROR, WARNING, and NOTE.
While ERROR messages must be corrected and WARNING messages must be corrected or documented, some NOTE messages may highlight points to consider.
On-Demand Messages
In addition, INFO: messages may appear when the global option msglevel=i is used.
options msglevel=i;
The message stating that variables common to the merged datasets are not listed in the by statement should be taken seriously.
This option generates a large number of messages. However, as far as I am aware, only the one regarding the merge is useful to the programmer.
User-Specific Messages
Finally, user-specific messages may also appear in the log. This is a common practice when developing SAS macros, to help end users interpret the results.
data _null_;
putlog 'MYMACRO: Macro Start';
run;
%put MYMACR: Macro Start;
What Makes a Good Filter?
Filtering the relevant lines from the log provides an overview of the items that need to be checked or modified.
Filters are useful, but good filters are even better. What makes a good filter?
- A filter that concisely lists all relevant issues—and only those.
- Un filtre facilement accessible afin de consulter le journal à chaque fois qu’un programme est exécuté.
If problems can be identified early on, even before running the program, that’s even better.
What Solutions Are Currently Available?
Altair Workbench Interface (Altair SLC/RapidMiner SLC)
With the Altair Workbench interface, you are alerted to certain syntax errors even before you run your code.
Let’s say you’ve forgotten a comma in your SQL procedure or there’s a missing end statement in your data step, then you’ll be notified about it in the Altair Workbench editor.
SAS Studio Interface
SAS Studio helps you identify ERROR, WARNING and NOTE messages, which are grouped together in the small header window of the log. Click on one of these messages to be taken to the corresponding line in the log. INFO messages are not included, even when the global option is enabled.
This makes it easier to manage ERRORs, but isn’t particularly practical for viewing other messages, especially critical NOTEs. It is difficult to keep track of all the issues that need resolving.
In-House Developed Interfaces
Some company-specific interfaces may offer additional features for filtering critical ERRORs, WARNINGS and NOTEs, such as messages identified by the company as issues requiring resolution or documentation.
A SAS Programme That Reads Your Log
A log file is simply an easily readable text file.
If you are unable to add a feature to your programming interface, you can create a programme that will list the messages that are relevant for you.
- Critical NOTEs
- User-specific messages
- Messages that need to be documented
This report may be useful in your programme validation process.
filename demo catalog 'work.pgm.procprint.source';
data _null_;
infile demo;
input ;
file print;
if find(_infile_,'ERROR:') ne 0 then put _infile_ ;
run;
filename demo clear;
In the example above, all lines containing the term ERROR: are sent to the default destination.
Leave a Reply