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.
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and save with the early bird rate—just $795!
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.