DATA Step, Macro, Functions and more

Macro Error Question

Reply
Regular Contributor
Posts: 173

Macro Error Question

Hello,

 

I get the following errors when executing themacro bbb.  the errors come from the line colored in red.  Any suggestions would be greatly appreciated. 

 

thank you in advance.

 

ERROR: Required operator not found in expression: wrd&i. in (&word_list.)

ERROR: The macro BBB will stop executing.

 

rsubmit;

%macro bbb(i);

%if wrd&i. in (&word_list.) %then %do;

var&j. = wrd&i.;

%let j = %eval(&j. + 1);

%end;

%mend;

endrsubmit;

 

rsubmit;

%macro all_rf;

data data5;

set data4;

%let j = 1;

%do i = 1 %to 60 ;

%bbb(&i.);

%end;

run;

%mend;

%all_rf;

endrsubmit;

Super User
Posts: 11,343

Re: Macro Error Question

And with RSUBMIT involved you may be missing a whole bunch of stuff that will impact the operation you are attempting.

 

What is your current definition of the macro varialble &word_list?

Are the "words" separated by the proper delimiter set by the MINDELIMITER system option?

 

You also do realiazize that the comparison is going to be case sensitive.

 

wrd1 will not match WRD1

 

You could also describe what you are attempting to do with this as it appears to be a somewhat convoluted way to do a look up of some flavor. Can you provide a small (not the apparent all 60 values/variables) example of what you are attempting to get with start data and what the final result should look like?

PROC Star
Posts: 102

Re: Macro Error Question

@KevinC_: I think the problem is with the IN clause.

First, you must make sure that the remote system recognizes IN - you should either use

rsubmit;
options minoperator;
%macro bbb(i);

or 

rsubmit;
%macro bbb(i)/minoperator;

The first method makes In valid in all macros in the remote session, the second method makes if valid for that specific macro, only.

 

Second, make sure that your WORD_LIST macro variable is not empty, I think that could create a message like the one you got:

rsubmit;
options minoperator;
%macro bbb(i);
%if %length(&word_list) %then
  %if wrd&i in(&word_list) %then %do;

 

If that does not work, check up on the documentation for the MINOPERATOR option.

Ask a Question
Discussion stats
  • 2 replies
  • 110 views
  • 1 like
  • 3 in conversation