Statistical Graphics Using ODS


Creating Graphs in Multiple Destinations

This section illustrates how to send your output to more than one destination with a single execution of your SAS statements. For example, to create LISTING, HTML, and RTF output, you can specify the ODS LISTING, ODS HTML, and the ODS RTF statements before your procedure statements. The ODS _ALL_ CLOSE statement closes all open destinations before and after the other statements are run.

ods _all_ close;
ods listing;
ods html;
ods rtf;

. . .

ods _all_ close;

You can also specify multiple instances of the same destination. For example, using the data in the section Contour and Surface Plots with PROC KDE, the following statements save the contour plot to the file contour.pdf and the surface plot to the file surface.pdf:

ods _all_ close;
ods pdf file="contour.pdf";
ods pdf select ContourPlot;
ods pdf(id=srf) file="surface.pdf";
ods pdf(id=srf) select SurfacePlot;
ods graphics on;

proc kde data=bivnormal;
   ods select ContourPlot SurfacePlot;
   bivar x y / plots=contour surface;
run;

ods _all_ close;

The ID= option assigns the name srf to the second instance of the PDF destination. Without the ID= option, the second ODS PDF statement closes the destination that was opened by the previous ODS PDF statement, and it opens a new instance of the PDF destination. In that case, the file contour.pdf is not created. For more information, see the ODS PDF statement in the SAS Output Delivery System: User's Guide.