BookmarkSubscribeRSS Feed
KevinC_
Fluorite | Level 6

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;

2 REPLIES 2
ballardw
Super User

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?

s_lassen
Meteorite | Level 14

@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.

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 2 replies
  • 805 views
  • 1 like
  • 3 in conversation