Hi all. I am doing many iterative full joins on different sets of variables. I would like to create a macro to simplify things, but I am not sure how to put the necessary code containing the variables into the macro. Here is a partially macroed version that works:
data data1x; input idx var1x $ var2x $; datalines;
1 moob shmoob
2 groob hoob
3 gloob poob
4 bloob poob
;
run;
data data1y; input idy var1y $ var2y $; datalines;
1 moob shmoob
2 froob bloob
3 gloob poob
4 gloob bloob
;
run;
%macro match (a,b);
proc sql;
create table match&a. as
select *
from data&b.x as x full join data&b.y as y
on x.var1x=y.var1y and x.var2x=y.var2y;
quit;
%mend match;
%match(2,1);
And this is what I would like to do:
%macro match (a,b,matchvars);
proc sql;
create table match&a. as
select *
from data&b.x as x full join data&b.y as y
on &matchvars.;
quit;
%mend match;
%match(2,1,x.var1x=y.var1y and x.var2x=y.var2y);
However, I get this error: "ERROR: Invalid macro parameter name x.var1x. It should be a valid SAS identifier no longer than 32 characters."
How can I successfully put this complex string of text into the macro? Thank you!
... View more