BookmarkSubscribeRSS Feed
sassygrl
Calcite | Level 5
As the subject line says, is there a way to programmatically check the log for error/warning messages?

I'm thinking in terms of a yes/no macro variable, or maybe an option to stop submitting code once there is an error message.

Thanks!
4 REPLIES 4
Doc_Duke
Rhodochrosite | Level 12
If you save the log to a file, you can search it with grep or using the SAS perl regular expressions. I'm not sure that is what you were searching for, but it works reasonably well in a batch environment.

Doc Muhlbaier
Duke
deleted_user
Not applicable
In my humble opinion, the best approach by far is to save the log as a file and then parse it for any of the SAS statements that indicate we have wrong data, bad code, system issues or misunderstandings. These can be as simple or as comprehensive as you need.

You might also look up the system macro symbols in the documentation that start with %Sys. These can give you some insight into the success or failure of individual steps.

Kind regards

David
sassygrl
Calcite | Level 5
Thanks to both!
JasonDiVirgilio
Quartz | Level 8
For those using Unix, a shell program like the following could catch common errors:

#!/bin/ksh
if [ $# != 1 ]
then
echo "Usage: mylogchecker.sh "
exit -1
fi

grep -n ERROR ./$1
grep -n WARNING ./$1
grep -in UNINITIALIZED ./$1
grep -in CONVERTED ./$1
grep -in REPEATS ./$1
grep -in 'BY ZERO' ./$1
grep -in UNKNOWN ./$1
grep -in 49-169 ./$1
exit

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!

Health and Life Sciences Learning

 

Need courses to help you with SAS Life Sciences Analytics Framework, SAS Health Cohort Builder, or other topics? Check out the Health and Life Sciences learning path for all of the offerings.

LEARN MORE

Discussion stats
  • 4 replies
  • 1908 views
  • 0 likes
  • 4 in conversation