Print Loop Macro

Note: This program was developed on a 32-bit Windows system.

Output Data Cleaning Reports by Table Name and ID

%macro printLoop(dset=,pdfDest=,rpt=);
data _null_; 
     retain N 0;
     set &dset. (keep=idnum iecnum) end=last;
     call symput("iecnum"||trim(left(_N_)),compress(iecnum));
     call symput("idnum"||trim(left(_N_)),compress(idnum));
     if last then call symput('N',trim(left(_N_)));        
run;
%do printLoop = 1 %to &N.;
data foo; set &dset.(where=(idnum="&&idnum&printLoop"));
run;
ods pdf body  = "&pdfDest.&d._&&idnum&printLoop...pdf"
        style = sasweb
        bookmarkgen=yes
        startpage=yes
        author="Columbia University Medical Center";
%inc &rpt.;
ods pdf close;
%end;
%mend printLoop;

Download SAS Program

To Output Data Cleaning Reports by Site, Table Name, and ID replace the PDF statement in the program with this statement below:

ods pdf body  ="&pdfDest.&&iecnum&printLoop&d._&&idnum&printLoop...pdf"

Leave a Comment

NOTE - You can use these HTML tags and attributes:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>