Creating PDF Files Using Universal Printing

PDF Files in SAS

PDF files can be read by the Adobe Acrobat Reader and other applications. In SAS, you create PDF files using the Output Delivery System (ODS). ODS uses the PDF Universal Printing printer to create a PDF. ODS provides styles and templates that you can apply to a document, or you can create your own styles and templates to customize a document. For more information, see ODS PDF Statement in SAS Output Delivery System: User's Guide.
For a description of the PDF printer, you can either view the printer in the SAS registry or submit the following QDEVICE procedure and view the output in the SAS log:
proc qdevice;
   printer pdf;
run;
Note: If you have SAS/GRAPH installed, your PDF output can contain links and pop-up text boxes. For more information, see Enhancing Web Presentations with Chart Descriptions, Data Tips, and Drill-Down Functionality in SAS/GRAPH: Reference.

Creating a PDF File

You can create a PDF file using the ODS PDF or ODS PRINTER statements. You specify the PDF universal printer either as the value of the PRINTERPATH= system option or as the value of the PRINTER= option in the ODS PRINTER statement. The ODS PDF statement creates output using the PDF universal printer. Therefore, you do not need to explicitly specify the PDF universal printer when you use the ODS PDF statement.
Here is some sample code to create a PDF file. In the first sample, the PDF universal printer does not need to be specified because the ODS PDF statement uses the PDF universal printer to create a PDF. In the second sample, the PDF universal printer is specified as the value of the PRINTERPATH= system option and the ODS PRINTER statement creates the PDF:
  • ods html close;
    ods pdf;
    
    ...more SAS code...
    
    ods pdf close;
    ods html;
  • options printerpath=pdf;
    ods html close;
    ods printer;
    
    ...more SAS code...
    
    ods printer close;
    ods html;
SAS creates a file sasprt.pdf in the current directory and opens the PDF in the Results Viewer window.

Example of Creating a PDF Using the ODS PDF Statement

This example creates a PDF file that contains the first five observations of the data set SASHELP.CLASS:
options obs=5 nodate pageno=1;
ods html close;
ods pdf;

proc print data=sashelp.class;
run;

ods pdf close;
ods html;
Here is the PDF output:
SASHELP.CLASS in a PDF File
SASHELP.CLASS in a PDF File