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! "
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:
(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
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:
(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
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.
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.
Ready to level-up your skills? Choose your own adventure.