Robinson
Robinson

Reputation: 45

SAS:how to use macro in if-else statement

when I merely used macro:

%extracTable();

there is no error..

however when I am using :

data _null_;

if 1=1

then %extracTable();

else put @@@do not insert@@@;

run;

it return :

error:unquote array:Execute

error:388-105

error 76-322

error:180-322

why and how to fix it...I am weak at sas Marco grammar..thank you

Upvotes: 0

Views: 53

Answers (1)

Petr
Petr

Reputation: 376

I think it's quite unlikely you want to use the same macro as a "standalone" script and inside data step if..then clause. If you want to execute the macro conditionally, try:

%macro extracTable();
%put some text;
%mend;

data _null_;
if 1=1 then call execute('%extracTable();');
else put '@@@do not insert@@@';
run;

Upvotes: 1

Related Questions