%macro exp_tables; %let lib = work; /* ++++++++++++++ CHANGE THIS TO THE LIBRARY WHERE THE OUTPUT FILES RESIDE +++++++++++*/ proc sql; Select distinct memname into :table_names separated by '#' from sashelp.VCOLUMN where libname = upcase("&lib"); quit; %let count = 1; %do %while (%scan(&table_names, &count.,str(#)) > 0); %let current_table = %scan(&table_names, &count.,str(#)); PROC EXPORT DATA = &lib..¤t_table OUTFILE = "Y:\somewhere\¤t_table..csv"; run; %let count = %eval(&count + 1); %end; %mend exp_tables;