BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
michellel
Calcite | Level 5

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);

1 ACCEPTED SOLUTION

Accepted Solutions
ballardw
Super User

%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

2 REPLIES 2
ballardw
Super User

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

michellel
Calcite | Level 5

Thanks ballardw. It works now.

sas-innovate-white.png

Special offer for SAS Communities members

Save $250 on SAS Innovate and get a free advance copy of the new SAS For Dummies book! Use the code "SASforDummies" to register. Don't miss out, May 6-9, in Orlando, Florida.

 

View the full agenda.

Register now!

How to connect to databases in SAS Viya

Need to connect to databases in SAS Viya? SAS’ David Ghan shows you two methods – via SAS/ACCESS LIBNAME and SAS Data Connector SASLIBS – in this video.

Find more tutorials on the SAS Users YouTube channel.

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