BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
rfitler
Calcite | Level 5

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:..."?   

1 ACCEPTED SOLUTION

Accepted Solutions
ballardw
Super User

@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.

View solution in original post

8 REPLIES 8
data_null__
Jade | Level 19

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.

SuryaKiran
Meteorite | Level 14

In SAS EG you can view the Log Summary Go to View>Log Summary

image.png

 

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

Thanks,
Suryakiran
ballardw
Super User

@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.

PaigeMiller
Diamond | Level 26

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.

--
Paige Miller
ballardw
Super User

@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.

PaigeMiller
Diamond | Level 26

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.

--
Paige Miller
ballardw
Super User

@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.

FreelanceReinh
Jade | Level 19

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.)

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

Mastering the WHERE Clause in PROC SQL

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.

Discussion stats
  • 8 replies
  • 6029 views
  • 0 likes
  • 6 in conversation