24.4 - Producing Other Types of Output

Printer-friendly versionPrinter-friendly version

Thus far, we have used ODS statements to tell SAS to create HTML output. As mentioned earlier, we can also use ODS statements to tell SAS to create other kinds of output. In this section, we'll take a look at two examples in which we tell SAS to make different kinds of output. In the first example, we make RTF output that can be easily copied into Microsoft Word. In the second example, we make PDF output that can be then sent to a high-resolution printer.

Using ODS Statements to Create RTF Output

Example 24.5. The following program tells SAS to print a subset of the penngolf data set and when doing so to send the output to an RTF destination:

As you can see, to tell SAS to send output to the RTF destination, we simply use the RTF keyword in an ODS statement. By default, titles and footnotes are put into Word headers and footers. The BODYTITLE option in the ODS RTF statement tells SAS to instead put titles and footnotes in the main part of the RTF document. Note that the second-to-last ODS statement tells SAS to close the RTF destination, while the last ODS statement tells SAS again to re-open the Listing destination.

Launch the SAS program. Then, edit the ODS RTF statement to reflect where you would like your RTF file stored. Then, run the SAS program. When you do so, a pop-up window that looks something like this should appear:

If you select Open, you'll see the contents of the golf5.rtf file (or whatever you called it) in the SAS Results Viewer. You can then easily copy the contents of the Results Viewer into a Word document. Alternatively, you can go to the folder in which you told SAS to store your RTF file:

and double-click on the file to open it in Word.

Using ODS Statements to Create PDF Output

Example 12.6. The following program does exactly the same thing as the previous program, except the output here is sent to a PDF file:

Pretty straightforward... as you can see, to tell SAS to send output to the PDF destination, we simply use the PDF keyword in an ODS statement. Note again that the second-to-last ODS statement tells SAS to close the PDF destination, while the last ODS statement tells SAS again to re-open the Listing destination.

Launch the SAS program. Then, edit the ODS PDF statement to reflect where you would like your PDF file stored. Then, run the SAS program. Again, there are a couple of things you can do to view the resulting PDF file. First, you can review the PDF file as it appears in the SAS Results Viewer. Alternatively, you can go to the folder in which you told SAS to store your PDF file:

and double-click on the file to open it.