ODS for PRINT, REPORT, - PowerPoint PPT Presentation

1 / 53
About This Presentation
Title:

ODS for PRINT, REPORT,

Description:

var Type Material Price; run; ODS HTML CLOSE; Original Table (remaining rows ... Specify styles for the row and column headings in the VAR and CLASS statements ... – PowerPoint PPT presentation

Number of Views:61
Avg rating:3.0/5.0
Slides: 54
Provided by: laurenh4
Category:
Tags: ods | print | report

less

Transcript and Presenter's Notes

Title: ODS for PRINT, REPORT,


1
ODS for PRINT, REPORT, TABULATE
  • Lauren HaworthGenentech, Inc., South San
    Francisco

2
Why are these PROCs Special?
  • For most procedures you must use PROC TEMPLATE to
    change your output style
  • PRINT, REPORT, and TABULATE allow you to change
    the output style attributes on the fly when the
    output is generated

3
This paper will show how to ...
  • Change the fonts, colors, and alignment of your
    output
  • Use formats to highlight key results in special
    colors
  • Add images to table headings

4
Output destinations
  • For convenience, all of the examples are shown as
    HTML output
  • Except where noted, the examples work for RTF or
    printer output as well

5
SAS versions
  • Based on SAS version 8.2
  • PRINT examples require 8.2
  • REPORT and TABULATE examples will also work with
    versions 8.0 and 8.1

6
The STYLE option
  • Specify different style attributes for specific
    parts of your output.
  • Style attributes control things like
  • typefaces
  • foreground and background colors
  • text alignment
  • table border styles

7
Changing Table Heading Styles for PROC PRINT
  • Start with a simple table of data
  • ODS HTML FILE'tables.htm' proc print
    datatables noobs label var Type Material
    Price run
  • ODS HTML CLOSE

8
Original Table
(remaining rows not shown)
9
Adding the STYLE option
STYLE option
Style element
  • ODS HTML BODY'tables.htm' proc print
    datatables noobs label STYLE(Header)FONT_FA
    CEArial Narrow var Type Material Price
    runODS HTML CLOSE

Value
Style attribute
10
Resulting table
Original
New
11
Changing Table Heading Styles for PROC REPORT
  • Start with a table similar to the previous
    example.
  • ODS HTML BODY'tables.htm' proc report
    datatables nowd column Type Material
    Price define Type / group define
    Material / group define Price / analysis
    mean runODS HTML CLOSE

12
Original Table
13
Adding the STYLE Option
  • Same technique as with PROC PRINT
  • ODS HTML BODY'tables.htm' proc report
    datatables nowd STYLE(Header)FONT_FACEAr
    ial Narrow column Type Material Price
    define Type / group define Material /
    group define Price / analysis mean
    runODS HTML CLOSE

STYLE option
Style element
Value
Style attribute
14
Resulting Table
Original
New
15
Changing Table Heading Styles for PROC TABULATE
  • Start with a table similar to the previous
    example.
  • ODS HTML BODY'tables.htm' proc tabulate
    datatables fdollar8. class Type
    Material var Price table
    TypeMaterial, PriceMean" "
    runODS HTML CLOSE

16
Original Table
17
How to Specify Style
  • TABULATE syntax is different
  • Specify styles for the row and column headings in
    the VAR and CLASS statements

18
Specifying the STYLE Options
  • ODS HTML BODY'tables.htm' proc tabulate
    datatables fdollar8. class Type Material
    / STYLEFONT_FACE"Arial Narrow"
    var Price / STYLEFONT_FACE"Arial
    Narrow" table TypeMaterial,
    PriceMean" " runODS HTML CLOSE

Value
Style attribute
STYLE option
19
Resulting Table
Original
New
20
Fixing the Remaining Row Headers
  • ODS HTML BODY'tables.htm' proc tabulate
    datatables fdollar8. class Type Material
    / STYLEFONT_FACE"Arial Narrow"
    classlev Type Material /
    STYLEFONT_FACE"Arial Narrow" var Price
    / STYLEFONT_FACE"Arial Narrow"
    table TypeMaterial, PriceMean" "
    runODS HTML CLOSE

21
Revised Results
First version
Revised
22
Applying Traffic Lighting to PROC PRINT
  • What do traffic lights have to do with SAS
    Output?
  • Redbad resultsYellowneutral resultsGreengood
    results
  • Great for focusing the readers attention on the
    key results.

23
Step 1 Set up a Format for Colors
  • proc format value traffic
    low-100'cx00CC33'
    100lt-300'cxFFFF66'
    300lt-high'cxFF3300'run

24
Step 2 Use the Format with STYLE
  • ODS HTML FILE'tables.htm' proc print
    datatables noobs label var Type Material
    var Price / STYLEBACKGROUNDtraffic.
    runODS HTML CLOSE

25
Resulting Table
  • Warning Notice that amounts are no longer
    formatted as dollars. This is to get around a
    v8.2 bug that affects using formats to apply
    styles in PROC PRINT.

26
Step 3 Fix the Font Weights
  • With color background, numbers hard to read
  • ODS HTML FILE'tables.htm'proc print
    datatables noobs label var Type Material /
    STYLEFONT_WEIGHTBOLD var Price /
    STYLEBACKGROUNDtraffic.
    FONT_WEIGHTBOLDrunODS HTML CLOSE

27
Resulting Table
28
Reversing the Effect
  • You can also do traffic lighting with colored
    numbers instead of colored backgrounds.
  • Change BACKGROUND to FOREGROUND
  • var Price / STYLEFOREGROUNDtraffic.
    FONT_WEIGHTBOLD

29
Same Table with FOREGROUND Colors
30
Applying Traffic Lighting to PROC REPORT
  • ODS HTML BODY'tables.htm' proc report
    datatables nowd column Type Material
    Price define Type / group
    STYLEFONT_WEIGHTBOLD define Material /
    group STYLEFONT_WEIGHTBOLD
    define Price / analysis mean
    STYLEBACKGROUNDtraffic.
    FONT_WEIGHTBOLD runODS HTML CLOSE

31
Resulting Table
32
Same Table with FOREGROUND Colors
33
Applying Traffic Lighting to PROC TABULATE
  • ODS HTML BODY'tables.htm' proc tabulate
    datatables fdollar8. class Type
    Material var Price table
    TypeMaterial, PriceMean" "
    STYLEBACKGROUNDtraffic.
    FONT_WEIGHTBOLD runODS HTML CLOSE

34
Resulting Table
35
Same Table with FOREGROUND Colors
36
Creating Alternate Row Shading
  • Technique for PROC REPORT
  • Alternate gray and white row backgrounds
  • Makes table easier to read

37
Using STYLE in the COMPUTE Block
  • ODS HTML BODY'tables.htm' proc report
    datatables nowd column Type Material
    Price define Type / group define
    Material / group define Price / analysis
    mean compute Material count1
    if (mod(count,2)) then do CALL
    DEFINE(_ROW_, "STYLE",
    "STYLEBACKGROUNDcxFFFFFF") end
    endcomp runODS HTML CLOSE

38
Resulting Table
39
Adding a Logo Graphic to PROC REPORT Step 1
  • ODS HTML BODY'tables.htm' proc report
    datatables nowd column Type Material
    Price define Type / group define
    Material / group define Price / analysis
    mean compute before _page_ / LEFT
    LINE "Totally Tables, Inc." endcomp
    runODS HTML CLOSE

40
Resulting Table
41
Adding a Logo Graphic to PROC REPORT Step 2
  • compute before _page_ / LEFT
    STYLEPREIMAGE'table.gif'
    FONT_WEIGHTBOLD FONT_SIZE5
    FOREGROUNDcx993300 LINE "Totally
    Tables, Inc."endcomp
  • Note This example is set up for HTML output, and
    gives the font size using a number which
    represents an HTML font size. If you are creating
    RTF or printer output, list the font size in
    points (for example, 14pt).

42
Resulting Table
43
Adding a Logo to PROC TABULATE
  • ODS HTML BODY'tables.htm' proc tabulate
    datatables fdollar8. class Type
    Material var Price table
    TypeMaterial, PriceMean" " /
    BOXLABEL'Totally Tables, Inc.'
    STYLEPREIMAGE'dining.gif' runODS HTML
    CLOSE

Original Label
Extra Brackets
Attribute
STYLE option
44
Resulting Table
45
Fixing the Heading Alignment
  • ODS HTML BODY'tables.htm' proc tabulate
    datatables fdollar8. class Type
    Material var Price / STYLEVJUSTB
    table TypeMaterial, PriceMean" "
    / BOXLABEL'Totally Tables, Inc.'
    STYLEPREIMAGE'dining.gif' runODS HTML
    CLOSE

46
Revised Table
47
Modifying the Entire Table
  • You can use STYLE to change the font, color,
    etc. for the entire table
  • Syntax
  • PROC REPORT DATAdataset STYLEstyle-attribut
    e(s)
  • PROC PRINT DATAdataset STYLEstyle-attribut
    e(s)

48
Modifying the Entire Table
  • Syntax for PROC TABULATE
  • TABLE ltltpage-definition,gt row-definition,gt
    column-definition / STYLEstyle-attribute(
    s)

49
Other Style Attributes
  • Dozens of style attributes you can modify
  • Many places to use them within each procedures
    output

50
Experiment
  • Try the various style attributes
  • Try the various places you can use STYLE
  • Get creative, especially with the COMPUTE block
    in PROC REPORT

51
To Learn More
  • Check out the examples in the Guide to the SAS
    Output Delivery System in the Online
    Documentation
  • Some more examples are in my new book Output
    Delivery System The Basics
  • Next year, look for Output Delivery System
    Advanced Topics

52
Conclusion
  • The possibilities for output enhancement are
    endless.
  • Have fun with these techniques.

53
Thanks for Coming!
  • Lauren Haworth
  • info_at_laurenhaworth.com
Write a Comment
User Comments (0)
About PowerShow.com