The %DO loop issues a PROC PRINT step for each data set. The %MEND statement ends the macro.
   %do i=1 %to #
      proc print data=&libname..&&ds&i noobs;
         title "Data Set &libname..&&ds&i";
      run;
   %end;
%mend printall;