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

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

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