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);
%INDEX is a SAS supplied macro function. You can't use that name for your macros. Change the name to something else.
%INDEX is a SAS supplied macro function. You can't use that name for your macros. Change the name to something else.
Thanks ballardw. It works now.
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.
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.