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

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

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
  • 1641 views
  • 0 likes
  • 4 in conversation