Include condicional
Condicional include
Condicional include
Laço em macro
/* Define the library name */
libname mylib 'path-to-your-library';
/* Get the list of all tables in the library */
proc sql noprint;
select memname into :table_list separated by ' '
from dictionary.tables
where libname = 'MYLIB';
quit;
/* Macro to export each table to an Excel file */
%macro export_tables;
%let count = %sysfunc(countw(&table_list));
%do i = 1 %to &count;
%let table = %scan(&table_list, &i);
proc export data=mylib.&table
outfile="path-to-your-directory/&table..xlsx"
dbms=xlsx replace;
run;
%end;
%mend export_tables;
/* Run the macro */
%export_tables;