I am using the following macro to print all the datasets ina library to single RTF file. However only the last available dataset is being printed in the RTF. Can any one suggest any modifications so that all the datasets are printed.
%macro printall(libname);
%local num i;
proc datasets library=&libname memtype=data nodetails;
contents out=temp1(keep=memname) data=_all_ noprint;
run;
data _null_;
set temp1 end=final;
by memname notsorted;
if last.memname;
n+1;
call symput('ds'||left(put(n,8.)),trim(memname));
if final then call symput('num',put(n,8.));
run;
%do i=1 %to #
ODS Listing Close;
ods rtf nogtitle file="C:\report1.rtf" style=profile ;
proc print data=&libname..&&ds&i noobs;
run;
ods rtf close;
%end;
%mend printall;
thanks in advance