Hello for all, I'm new using SAS and PROC SQL. I wrote a code to cartesian product with different values of 5 variables but i want to parameterize it. %macro first_macro(size);
%let list_var = var1 var2 var3 var4 var5;
%do i=1 %to &size;
%let var = %scan(&list_var,&i);
proc sql;
create table table&i as
select distinct &var
from file
quit;
%end;
PROC SQL;Create Table cross_1 as Select monotonic() as id_5,* from table1,table2,table3,table4,table5;Quit;
PROC SQL;Create Table cross_2 as Select monotonic() as id_4,* from table1,table2,table3,table4;Quit;
PROC SQL;Create Table cross_3 as Select monotonic() as id_3,* from table1,table2,table3;Quit;
PROC SQL;Create Table cross_4 as Select monotonic() as id_2,* from table1,table2;Quit;
PROC SQL;Create Table cross_5 as Select monotonic() as id_1,* from table1;Quit;
%mend;
%first_macro(5); There is one way to declare a list of tables separated by ',' and using it in proc sql sentence with loop? thanks
... View more