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

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

Register Now

Creating Custom Steps in SAS Studio

Check out this tutorial series to learn how to build your own steps in SAS Studio.

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