jingju11 发表于 2010-1-21 22:28
1# saslovime Quote the string ‘1=1’ at macro compile time. Without quoting, the string may be resolved in an unexpected way at some cases, even I did not see what the quotation exactly functions here.
You are right.
But it still seems to the %str here is redundant because (1=1) is a legitimate expression with no 'confusion'.
145 data _null_;
146 sourceSubset=1;
147 if sourceSubset=%str(1=1) then put '1';
148 else put '0';
149 run;
1
NOTE: DATA statement used (Total process time):
real time 0.00 seconds
cpu time 0.00 seconds
150
151 %macro t(d);
152 %let sourceSubset=1;
153 %if &sourceSubset=%str(1=1) %then %put >>>1;
154 %else %put >>>0;
155 %mend;
156
157 %t(d);
>>>0