BookmarkSubscribeRSS Feed
JMarkW
Fluorite | Level 6
Does anybody know exactly how the %if (1) %then %let sqlldr_rc=&sysrc line works?

I'm not familiar with %if (1)
4 REPLIES 4
deleted_user
Not applicable
Expression in %if can be any valid macro expression that resolves to an integer. If expression is evaluated to zero, then it is false and the %then text is not processed. If it resoles to any integer other than zero, then the expression is true, and the %then text is processed. If it resolves to null or to any noninteger value, an error message is issued.
sbb
Lapis Lazuli | Level 10 sbb
Lapis Lazuli | Level 10
The SAS macro code is using a technique to force a TRUE condition test result. A value of 1 is TRUE and a value of 0 is false. You can see this processing decision during SAS code compilation if you turn on:

options source source2 macrogen symbolgen mlogic;



Scott Barry
SBBWorks, Inc.
JMarkW
Fluorite | Level 6
Thanks! I didn't expect the (1) to force a true test result. I'm not sure why the programmer didn't just code

%let sqlldr_rc=&sysrc;

Maybe this is a little slop accidently left in the code.
LinusH
Tourmaline | Level 20
In conditional logic, 1 means TRUE. So your %if will always be true, and the assignment of sqlldr_rc will always happen.

/Linus
Data never sleeps

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!

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.

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
  • 4 replies
  • 631 views
  • 0 likes
  • 4 in conversation