Unlike the IF clause in regular SAS data step, the %IF macro statement processes from left to right, which means the expression
%IF 1<&tab.<4
first evaluates the 1<&tab component. When macrovar &TAB equals 3, this component resolves to 1 (for true). When macrovar &TAB is, say 0, this component resolves to 0 (for false).
Then it tests whether that resolved value is less than 4, which is also true (because both 0 and 1 are <4). In fact, for any &TAB value, the %IF 1<&tab.<4 macro test will always be true.
But as you no doubt know, this is NOT the behavior of the non-macro IF statement, which imputes an implicit AND operator when you have the if value1 relop value2 relop value3 structure (where "relop" means relational operator). So the expression
if 1<%tab.<4
is interpreted as
if 1<&tab. AND &tab<4
... View more