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-2026-white.png



April 27 – 30 | Gaylord Texan | Grapevine, Texas

Registration is open

Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 4 replies
  • 1349 views
  • 0 likes
  • 4 in conversation