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 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

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