SAS author's tip: Using ODS to send output to alternate destinations


SAS Statistics by ExampleRon Cody starts things off right with our first SAS tip of 2014. If you resolve to become a better statistical programmer this year, Ron's book SAS Statistics by Example is a great place to start.

After you take a look at this week's free excerpt from the book, head over to Ron's author page. You'll find a list of his many available publications and more bonus content. Cheers!

The following excerpt is from SAS Press author Ron Cody's book “SAS Statistics by Example” Copyright © 2011, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED. (please note that results may vary depending on your version of SAS software).

Using ODS to Send Output to Alternate Destinations

To demonstrate the flexibility of the SGPLOT procedure, the next example shows you how to use a built-in style to send the same chart to a PDF file.

This program is identical to the previous one, except you place an ODS statement before the procedure that tells SAS two things: 1) you want to produce a PDF file and 2) you want to use the built-in style called JOURNAL. Following the procedure, you close the destination using another ODS statement.

You should close all your ODS destinations before you exit your SAS session. It is also a good idea to include the ODS LISTING CLOSE statement before the procedure so that you don’t get two outputs—one sent to the PDF file and the other sent to the normal SAS output location. Remember that you need to reopen the listing file using the ODS LISTING statement following the procedure.

The PDF file that was created by Program 3.8 looks like this:

This PDF file can be read by Adobe and used in any application that can work with PDF files.


About Author

Shelly Goodin

Social Media Specialist, SAS Publications

Shelly Goodin is SAS Publications' social media marketer and the editor of "SAS Publishing News". She’s worked in the publishing industry for over thirteen years, including seven years at SAS, and enjoys creating opportunities for fans of SAS and JMP software to get to know SAS Publications' many offerings and authors.

Related Posts

Comments are closed.

Back to Top