%include is not a macro invocation, but rather something like a "compiler directive" in other computer languages. This affects the timing when exactly the source is "included," which is earlier than the timing expected by a macro invocation. Anyway, I agree with Arthur in that there may be a better way to implement what you are trying to do. But, if you insist, then here is something close to what you asked for. /* save this file as c:\temp\test.sas before you submit it */ x cd "c:\temp\"; %macro bulk(ok); %put this is the <bulk> &=ok; %mend bulk; data _null_; if not symexist("ok") then do; call execute('%global ok; %let ok=0;'); call execute('%bulk(ok=&ok);'); call execute('%let ok=1;'); call execute('%include "c:\temp\test.sas";'); end; else do; call execute('%bulk(ok=&ok)'); call execute('%symdel ok;'); end; run; /* on log -- some notes removed this is the <bulk> OK=0 ... this is the <bulk> OK=1 */
... View more