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-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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.

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