
2023-10-27_17-40-39.png
%macro m_exp2all(_lib=, _dsin=);
%if not %length(&_dsin) %then
%do;
proc sql noprint nowarnrecurs;
select distinct memname into: _dsin separated by ' ' from
dictionary.columns where libname="%upcase(&_lib)";
quit;
%end;
%let _dsnum=%sysfunc(countw(&_dsin, %str( )));
libname exfile xlsx "/location/%upcase(&protocol)_%lowcase(&report)_%lowcase(&_lib)_all_&sysdate..xlsx";
%do iii=1 %to &_dsnum;
%let _tmpds=%Scan(&_dsin, &iii, %str( ));
data exfile.&_tmpds.;
%if %length(&_lib) %then
%do;
set &_lib..&_tmpds.;
%end;
%else
%do;
set &_tmpds.;
%end;
run;
%end;
libname exfile clear;
%mend m_exp2all;
%m_exp2all(_lib=data_s, _dsin=);