SAS Data Integration Studio, DataFlux Data Management Studio, SAS/ACCESS, SAS Data Loader for Hadoop and others

ERROR: Macro function %INDEX has too many arguments.

Accepted Solution Solved
Reply
Contributor
Posts: 66
Accepted Solution

ERROR: Macro function %INDEX has too many arguments.

Hi,

 

I have a question about defining macro. I included input file 1, input file 2, and year in a macro. When I ran the macro, it always showed a error that  Macro function %INDEX has too many arguments. If I cut this macro into several piece macros, there would no problem to run each of those macros. Here is my macro. Thanks so much in advance for your help!

 

%macro index(in1,in2,yy);

data carr&yy;

set &in1;

if ...(some conditions here)...

then interest = 1;

else interest=0;

if interest;

run;

 

proc sql;

create table finder&yy as

select distinct id

from carr&yy;

quit;

 

 

proc sort data=&in2;

by id;

run;

 

data merged&yy;

merge finder&yy(in=a)

&in2(in=b);

by id;

if a and b;

 

if (year(DEATH_DT)~=&yy and MONS=12)or (year(DEATH_DT)=&yy and MONS=month(DEATH_DT) )

then ff=1;

else ff=0;

 

*if ff=1;

 

run;

%mend;

%index(raw.myfile1,raw.myfile2,2012);


Accepted Solutions
Solution
‎05-16-2016 11:31 AM
Super User
Posts: 10,500

Re: ERROR: Macro function %INDEX has too many arguments.

%INDEX is a SAS supplied macro function. You can't use that name for your macros. Change the name to something else.

View solution in original post


All Replies
Solution
‎05-16-2016 11:31 AM
Super User
Posts: 10,500

Re: ERROR: Macro function %INDEX has too many arguments.

%INDEX is a SAS supplied macro function. You can't use that name for your macros. Change the name to something else.

Contributor
Posts: 66

Re: ERROR: Macro function %INDEX has too many arguments.

Thanks ballardw. It works now.

☑ This topic is SOLVED.

Need further help from the community? Please ask a new question.

Discussion stats
  • 2 replies
  • 390 views
  • 0 likes
  • 2 in conversation