Do errors and warnings ALWAYS appear in the log as "ERROR:.." and "WARNING:..."? If so, then instead scrolling through the log (which can be long is many cases), can't you simply search (i.e., find) the log for ERROR:.." and "WARNING:..."?
@PaigeMiller wrote:
All of the above translates into "there's no easy way to do this search for errors and warnings in Base SAS".
The fact that Enterprise Guide and SAS/Studio make this easy doesn't help in Base SAS.
RegEx doesn't help in the LOG window, there is no way to do a RegEx on the text in the LOG window. (yes you could read the LOG into the Enhanced Editor window and then use RegEx there but that doesn't constitute easy to me).
And the last suggestion by @ballardw seems to be the closest, but there's no way to save this search, everytime you do it you have to do a Ctrl-F and then type the word ERROR and turn on the proper search options.
Actually, at least in my install of SAS 9.4 for Windows 10 , the Find dialog for the LOG window will retain the last settings such as "match case" or "whole word" and defaults to the last searched term, at least within a session.
There are some errors that have numbers between the word error and :
ERROR 180-123:
But they always start in column 1 of the log and you can make an RegEX to search but you will have to lookup the meta characters.
In SAS EG you can view the Log Summary Go to View>Log Summary
You can write the log into a file using PROC PRINTTO and then scan that file for any errors or warnings or etc, for this there are several papers out there.
http://support.sas.com/resources/papers/proceedings12/042-2012.pdf
https://www.lexjansen.com/pharmasug/2008/cc/CC02.pdf
@rfitler wrote:
Do errors and warnings ALWAYS appear in the log as "ERROR:.." and "WARNING:..."? If so, then instead scrolling through the log (which can be long is many cases), can't you simply search (i.e., find) the log for ERROR:.." and "WARNING:..."?
Depends somewhat on which version of SAS you are using as tools for the Log are a tad different. The foundation or base SAS Log you could restrict the search to ERROR plus the "match whole word" and "match case" options.
All of the above translates into "there's no easy way to do this search for errors and warnings in Base SAS".
The fact that Enterprise Guide and SAS/Studio make this easy doesn't help in Base SAS.
RegEx doesn't help in the LOG window, there is no way to do a RegEx on the text in the LOG window. (yes you could read the LOG into the Enhanced Editor window and then use RegEx there but that doesn't constitute easy to me).
And the last suggestion by @ballardw seems to be the closest, but there's no way to save this search, everytime you do it you have to do a Ctrl-F and then type the word ERROR and turn on the proper search options.
@PaigeMiller wrote:
All of the above translates into "there's no easy way to do this search for errors and warnings in Base SAS".
The fact that Enterprise Guide and SAS/Studio make this easy doesn't help in Base SAS.
RegEx doesn't help in the LOG window, there is no way to do a RegEx on the text in the LOG window. (yes you could read the LOG into the Enhanced Editor window and then use RegEx there but that doesn't constitute easy to me).
And the last suggestion by @ballardw seems to be the closest, but there's no way to save this search, everytime you do it you have to do a Ctrl-F and then type the word ERROR and turn on the proper search options.
Actually, at least in my install of SAS 9.4 for Windows 10 , the Find dialog for the LOG window will retain the last settings such as "match case" or "whole word" and defaults to the last searched term, at least within a session.
Yes, @ballardw mine does too, but you still have to re-type and select the settings again in a new SAS session. It would be nice if this could be saved and then called up via a single keystroke, I know there are text editors out there where you can do this.
@PaigeMiller wrote:
Yes, @ballardw mine does too, but you still have to re-type and select the settings again in a new SAS session. It would be nice if this could be saved and then called up via a single keystroke, I know there are text editors out there where you can do this.
Very much agree. And it can't be that hard as the Enhanced Editor Search and Replace does this, well at least it keeps the last x find and replaces available in drop downs, but the settings for whole word, case or regular expression are kept.
Hi @rfitler and welcome to the SAS Support Communities!
As you can see from the papers mentioned by @SuryaKiran, searching for "ERROR" and "WARNING" is only a very basic log check and sophisticated macros have been developed to refine these checks substantially in order to meet industrial quality standards.
In addition to the occasionally missing colon after "ERROR" (as mentioned by @data_null__) there are rare cases where an error message looks different, e.g., once I saw this on a Linux server:
Segmentation Violation In Task [ DATASTEP ]
followed by a number of Linux path names and hex codes, but also the note
NOTE: The SAS System stopped processing this step because of errors.
So, the keyword "error" was at least there.
Here is a (hopefully) reproducible example where an error occurs, but only NOTEs are written to the log (again one containing the word "errors", though):
1 data _null_; 2 length text $256; 3 infile log; NOTE: The file LOG cannot be opened for UPDATE processing. 4 input text; 5 run; NOTE: The SAS System stopped processing this step because of errors. NOTE: DATA statement used (Total process time): real time 0.01 seconds cpu time 0.01 seconds
But the more difficult problem is the large number of possible NOTEs (without "errors") indicating that something went wrong (e.g. division by zero). Also that number is growing (e.g. when new procedures are introduced) and I don't know where to find a complete list in the documentation. I remember to have seen an approach where people put together a positive list of acceptable log messages (rather than a negative list of not acceptable ones) and used this in their log checker. (Not sure how successful that was.)
Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!
SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.
Find more tutorials on the SAS Users YouTube channel.