/* Richard A. DeVenezia * * Send 200 plots to a printer. Two plots per page. * Sample coded for 10feb05 SAS-L question * - "proc gplot" by Nishant Dholakia */ * Prepare - cowboy hat data; data hat; do x=-5 to 5 by .25; do y=-5 to 5 by .25; z=sin(sqrt(x*x+y*y)); output; end; end; run; * Prepare - macro to make plots; %macro plots (n=10); %local i; goptions goutmode=replace; %do i = 1 %to &n; %let rotate = %sysevalf(90 * &i/&n); %let tilt = %sysevalf(90 * &i/&n); proc g3d data=hat gout=work.myPlots; plot y*x=z/ctop=red cbottom=black rotate=&rotate tilt=&tilt; title 'Cowboy Hat with G3D'; footnote 'From SAS Online Help'; run;quit; goptions goutmode=append; %end; %mend; * Prepare - macro to replay plots; %macro replay (npages=5); goptions vsize=10in hsize=7.5in; %local i counter; %let counter=0; %do i = 1 %to &npages; proc greplay nofs tc=work.myTemplates igout=work.myPlots; template twoup; treplay %let counter = %eval (&counter+1); 1: &counter %let counter = %eval (&counter+1); 2: &counter ; quit; %end; %mend; * Prepare - template for replaying plots; proc greplay nofs tc=work.myTemplates; tdef twoup 1 / llx=0 lly= 0 ulx=0 uly= 49 urx=100 ury= 49 lrx=100 lry= 0 2 / llx=0 lly=51 ulx=0 uly=100 urx=100 ury=100 lrx=100 lry=51 ; run; quit; * Prepare - set printer; *options sysprint="Deparment X's Color Printer; options orientation = portrait; * Action - make plots, note vsize is half portrait vsize; goptions reset=all ftext=Swiss; goptions nodisplay device=win target=winprtc hsize=7.5in vsize=5in nodisplay; %plots (n=4); * test; *%plots (n=200); * production; * Action - replay plots; goptions display device=win; * plots on screen; *goptions display device=winprtc; * plots on sysprint; %replay (npages=2); * test; *%replay (npages=100); * production;