Was hoping someone could help me. Probably an easy answer to this, but I can't figure it out.
Let's say I have the following macro:
%macro first(dsn, bylist, outdat);
proc sql;
create table &outdat
select &bylist
from &dsn;
quit;
%mend first;
%first(dsn=mydata, bylist=x y z, outdat=outfile);
My problem is that I want to build a select statement based on the variables I feed the macro using the macro variable bylist. The problem is, of course, that the list has to be separated by commas in the select statement in proc sql. I need to feed the macro a list of items to use in that select statement because the variables will change with each call to the macro and the number of variables in that bylist will change as well. In other words I need to tell the macro what variables I want to use in the select statement with each call to the macro. Is there an easy way to do this? I'm drawing a blank.
Thanks in advance so much for your help.