Vincent
Vincent

Reputation: 955

How to conditionally define a macro-variable inside proc iml?

I have an issue with combining proc iml, if/then and call symputx. If I run the following code :

proc iml;

call symputx("noif",3);
a=1;
b=&noif;                              /* 1) : works*/
if a=1 then call symputx("withif",1);
if a=1 then print a;                  /* 2) : works */
c=&withif;                            /* 3) : doesn't work */
quit;
%put &withif;                         /* 4) : works */

What is the proper way to conditionally define a macro-variable inside proc iml ?

Upvotes: 2

Views: 817

Answers (1)

Vincent
Vincent

Reputation: 955

Rick Wicklin answered my question on his blog. Basically, I needed to add empty else statements after my if/then blocks for IML to know they were finished.

Upvotes: 2

Related Questions