Hi:
You could "macro-ize" something like the program example below. It is always best, however to start with a basic non-macro program and understand how it works before you convert it to a macro program.
cynthia
[pre]
data new;
set sashelp.prdsale(in=prdsale)
sashelp.prdsal2(in=prdsal2)
sashelp.prdsal3(in=prdsal3);
if prdsale=1 then filename = 'SASHELP.PRDSALE';
else if prdsal2 = 1 then filename = 'SASHELP.PRDSAL2';
else if prdsal3 = 1 then filename = 'SASHELP.PRDSAL3';
run;
ods listing;
proc freq data=new order=data;
tables filename;
run;
[/pre]