BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
TimWright
Obsidian | Level 7

Is it  possible, in either SAS 9.4 or SAS enterprise, to create a custom warning?  For example, my friend and I were thinking out loud that it would be helpful having SAS give a warning when I do a RIGHT JOIN in proc SQL, because this is something that could have dreadful consequences if it was used incorrectly.  It could say "warning: You are doing a Right Join! "    

1 ACCEPTED SOLUTION

Accepted Solutions
CaseySmith
SAS Employee

Yes, you can print custom warnings (or errors or notes) to the SAS log via put statements in SAS code. For example, if you submit this somewhere in your SAS code...

 

%put WARNING: You are doing something I need to warn you about!;

 

...it will show up in the log and the log summary view, like so:

customWarning.png

 

(Use "%put ERROR: error text;" or "%put NOTE: note text;" for custom errors or notes.)

 

Granted, you'd have to be able to detect the scenario you wish to warn via code, so your code knows when to conditionally print the warning. That might be difficult with the example you mentioned.

 

Casey


Register today and join us virtually on June 16!
sasglobalforum.com | #SASGF

View now: on-demand content for SAS users

View solution in original post

2 REPLIES 2
CaseySmith
SAS Employee

Yes, you can print custom warnings (or errors or notes) to the SAS log via put statements in SAS code. For example, if you submit this somewhere in your SAS code...

 

%put WARNING: You are doing something I need to warn you about!;

 

...it will show up in the log and the log summary view, like so:

customWarning.png

 

(Use "%put ERROR: error text;" or "%put NOTE: note text;" for custom errors or notes.)

 

Granted, you'd have to be able to detect the scenario you wish to warn via code, so your code knows when to conditionally print the warning. That might be difficult with the example you mentioned.

 

Casey


Register today and join us virtually on June 16!
sasglobalforum.com | #SASGF

View now: on-demand content for SAS users

TimWright
Obsidian | Level 7
Yes. I see that programming it would be tricky. But I see what you mean. You would just use a conditional %put statement . Thanks

sas-innovate-wordmark-2025-midnight.png

Register Today!

Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.


Register now!

SAS Enterprise Guide vs. SAS Studio

What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.

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
  • 8273 views
  • 1 like
  • 2 in conversation