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-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

New Learning Events in April

 

Join us for two new fee-based courses: Administrative Healthcare Data and SAS via Live Web Monday-Thursday, April 24-27 from 1:00 to 4:30 PM ET each day. And Administrative Healthcare Data and SAS: Hands-On Programming Workshop via Live Web on Friday, April 28 from 9:00 AM to 5:00 PM ET.

LEARN MORE

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