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. 

sas-innovate-2026-white.png



April 27 – 30 | Gaylord Texan | Grapevine, Texas

Registration is open

Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!

Register now

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

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