I think you are seeking something more generic, along the lines of a macro: %macro vlist (list1=, list2=) ; %local j k ; %do j=1 %to %sysfunc(countw(&list1) ) ; %do k=1 %to %sysfunc(countw(&list2) ) ; table2_%scan(&list1, &j)_2017_%scan(&list2, &k) %end; %end;
%mend vlist; Then you can use the macro where you want the list of names such as: drop %vlist (list1= usa canada uk japan southafrica, list2 = population crime rate gnp) ;
... View more