Chapter 5 ODS ODS the Output Delivery System

  • Slides: 8
Download presentation
Chapter 5 - ODS • ODS (the Output Delivery System) allows you to output

Chapter 5 - ODS • ODS (the Output Delivery System) allows you to output to many possible “destinations” (see p. 144 for the entire list): – LISTING (standard SAS output) – OUTPUT (SAS output dataset) – HTML (for the web) – RTF (rich text format - Microsoft Word) – PDF (for portability) – PS (postscript)

 • See the diagram on page 145 for an understanding of Style and

• See the diagram on page 145 for an understanding of Style and Table Templates and how ODS handles them… note there are many built-in templates (use PROC TEMPLATE; LIST STYLES; RUN; to see them…). Note also that there are certain defaults: – DEFAULT is the default style for HTML destination – RTF is the default style for RTF destination – PRINTER is the default style for output sent to the PRINTER destination – Some PROCs allow you to use style templates through the STYLE= option directly in the procedure code…

 • ODS combines data from a PROC with a table template to form

• ODS combines data from a PROC with a table template to form an output object - every output object has a name and you can find the names using the ODS TRACE statement (check in the LOG window…): ODS TRACE ON; *… run the PROC steps you want to TRACE here; RUN; ODS TRACE OFF; * for example, try the program on page 146…;

DATA giant; INFILE 'c: My. Raw. DataTomatoes. dat' DSD; INPUT Name : $15. Color

DATA giant; INFILE 'c: My. Raw. DataTomatoes. dat' DSD; INPUT Name : $15. Color $ Days Weight; datalines; Big Zac, red, 80, 5 Delicious, red, 80, 3 Dinner Plate, red, 90, 2 Goliath, red, 85, 1. 5 Mega Tom, red, 80, 2 Big Rainbow, yellow, 90, 1. 5 Pineapple, yellow, 85, 2 *Trace PROC MEANS; ODS TRACE ON; PROC MEANS DATA = giant; BY Color; RUN; ODS TRACE OFF;

Carefully look at the output from the TRACE to see there is one output

Carefully look at the output from the TRACE to see there is one output object for each of the values of the BY-group variable. Once you know the names of the output objects, you may select only the ones you want with the statement: ODS SELECT output_object_list; Recall that we used an OUTPUT statement in our PROC MEANS in section 4. 10; with the ODS OUTPUT statement as follows: ODS OUTPUT output_object = dataset_name; Of course, you have to know the name of the output object (or its label or path) (use TRACE to find these values)

Do the example on page 149… here “Table” is the name of the output

Do the example on page 149… here “Table” is the name of the output object (from the TRACE previously done) and “tabout” is the name of the newly created dataset name…Use PROC PRINT data=tabout; to see the output dataset… ODS OUTPUT Table = tabout; To send output to HTML for use on a website for example, you need one ODS statement to open the HTML file and one to close it. Look at the program on page 151 and the corresponding output at the bottom of the page… Note the use of all of the BODY, CONTENTS, PAGE, and FRAME files in the one ODS HTML … ; statement.

Do the same example but put the data into an RTF file as on

Do the same example but put the data into an RTF file as on page 153. ODS RTF FILE=‘…. rtf’ options ; *put the first and last statements around the procs whose output you want to capture in the. rtf file; ODS RTF CLOSE; To send output to a PDF file, use ODS PDF FILE=‘…. pdf’ options ; *put the first and last statements around the procs whose output you want to capture in the. pdf file; ODS PDF CLOSE;

Similarly, you may put output into a Postscript file (ODS PS FILE=‘…. ps’ options

Similarly, you may put output into a Postscript file (ODS PS FILE=‘…. ps’ options ; ) Sections 5. 7 -5. 12 show to modify the output using the STYLE= options and the other options in the TITLE and FOOTNOTE statements… those are: COLOR= (color of the text) BCOLOR= (color for the bsckground of the text) HEIGHT= (specifies how tall the text is) JUSTIFY= (left, center, right) FONT= (there are many fonts you may use…) BOLD ITALIC HW: 1. Run all the sample programs in the book for section 5. 7 -5. 12 2. Practice the STYLE statements in our other programs…