BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
paulkaefer
Lapis Lazuli | Level 10

I've seen a few places, including here, the recommendation to put 'ERR' and then 'OR: <error message>' when printing a user-defined error message to the log.

 

I tried it to see the difference from simply putting it all in one string:

 

data _NULL_;
    put 'ERROR: this is an error';
    put 'ERR' 'OR: this is another';
run;

They both seem to work the same way. Is this something that was more important in the past?

1 ACCEPTED SOLUTION

Accepted Solutions
Reeza
Super User

I think this had to do with avoid log parsing tools that scanned the logs for errors in a company. No production code can have the word ERROR in it. 

View solution in original post

2 REPLIES 2
Reeza
Super User

I think this had to do with avoid log parsing tools that scanned the logs for errors in a company. No production code can have the word ERROR in it. 

Quentin
Super User

Agree with @Reeza that it is for easier log scanning.  In my experience, when people have a log scanning program (SAS or other), it is usually smart enough to distinguish between the word "ERROR" in code and an actual ERROR message in the log (in particular, in the log the line will start with "ERROR"). 

 

But in the setting where a person (or group) does not have a log scanning utility, often people resort to a quick-and-dirty scan of the log by just using CTRL-F for find.  In that case, if the word "ERROR" appears in code, it will be caught by the FIND command.  And if it happens too many times, the user might just give up on log review (which is always a bad idea...) 

 

So separating into "ER" "ROR" makes code uglier but easier for a naive log review (which is worse than an automated log review but better than no log review).

 

In my macros I do the even uglier: %PUT ER%str()ROR:  <Blah>;   I have a function key / keyboard macro assigned to generate PUT "ER" "ROR:" and %PUT ER%str()ROR: , which saves a little typing. 

BASUG is hosting free webinars Next up: Mike Raithel presenting on validating data files on Wednesday July 17. Register now at the Boston Area SAS Users Group event page: https://www.basug.org/events.

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 2 replies
  • 1245 views
  • 2 likes
  • 3 in conversation