Some code that might help demonstrate the difference %macro ifdemo(); data test; do i=1 to 5; j=1; %let k=1; if j then put "j is not zero or missing"; %if &k %then %put k is not zero or missing; end; run; %mend; %ifdemo; When you run this and check the log, you'll see: k is not zero or missing j is not zero or missing j is not zero or missing j is not zero or missing j is not zero or missing j is not zero or missing What happens here: first, SAS goes through the code looking for macro statements/macro variables and executing/resolving them. In this case, it sets k=1, then tests the value of k and prints to the log. This only happens once - it's not paying any attention to the DO loop at this stage because it's not a macro command. After it's finished dealing macros, it then goes back and runs the DATA step. Now the i-loop runs and the PUT statement for j executes 5 times.
... View more