Using the new Version 8 Template Procedure for Complete Control of SAS Output Style and Format - PowerPoint PPT Presentation

1 / 26
About This Presentation
Title:

Using the new Version 8 Template Procedure for Complete Control of SAS Output Style and Format

Description:

A single style template affects the general look of all the output within a given document. ... both style and table templates may also inherit elements and ... – PowerPoint PPT presentation

Number of Views:141
Avg rating:3.0/5.0
Slides: 27
Provided by: tor5
Category:

less

Transcript and Presenter's Notes

Title: Using the new Version 8 Template Procedure for Complete Control of SAS Output Style and Format


1
Using the new Version 8 Template Procedure for
Complete Control of SAS Output Style and
Format
David GhanTechnical Training SpecialistSAS,
Canada
2
  • Objective
  • demonstrate the power of Proc Template to
    customize SAS output format
  • outline the general framework for how this is
    done and introduce some key concepts for starting
    with Proc Template.

3
Output Delivery System (ODS)
FLEXIBILITY
4
ODS Destinations
Report Destinations
Listing
HTML
RTF
Printer
Data Destination
Output
5
ODS Output Production
Destination
Result
SASData Set Output Window HTMLFile RFT File
Output Listing HTML RTF
Pre-defined templates provided, but can
customize
6
Why Use ODS and Proc Template?
  • form and appearance matter.
  • automate the formatting process
  • production jobs
  • applications
  • make results accessible to users in their
    preferred form.
  • no post-production point-and-click.

7
  • Template Types
  • Table
  • column
  • header
  • footer
  • Style
  • Presentation
  • Colors
  • Fonts
  • There are specific table template for each type
    of output object.
  • A single style template affects the general look
    of all the output within a given document.

8
The general structure of templates
style template
table template
header
footer
column
table
style elements
attributes
attributes
attributes
attributes
attributes
values
values
values
values
values
9
  • Objectives
  • projected airfares on all flight routes in 3
    seat classes over 4 years.
  • a frequency report for number of employees in
    different job classes.

SAS text output
Projected Ticket Rates Route First
Class Business Economy First Class
Business Economy Number Fare Year 1
Fare Year1 Fare Year1 Fare Year2 Fare
Year2 Fare Year2 0000001 1,600.00
1,090.00 531.00 1,942.00
1,323.00 645.00 0000002 1,600.00
1,090.00 531.00 1,942.00
1,323.00 645.00 0000003 1,761.00
1,201.00 585.00 2,139.00
1,458.00 711.00 0000004 1,761.00
1,201.00 585.00 2,139.00
1,458.00 711.00 0000005 176.00
120.00 58.00 213.00
145.00 71.00 0000006 176.00
120.00 58.00 213.00 145.00
71.00 . . .
. . . . . . .
. . . .
Counts by Job Code
Job Code Job
Cumulative Cumulative Code Frequency
Percent Frequency Percent
BAGCL
K 140 6.76 140
6.76 BAGSUP 18 0.87 158
7.63 CHKCLK 125 6.04
283 13.67 CHKSUP 18
0.87 301 14.54 FACCLK
124 5.99 425 20.53 .
. . . . . .
. . .
10
  • Objectives (contd)
  • Create the SAS output in HTML format and RTF
    (Rich Text Format) using standard templates
    supplied by SAS.

RTF
HTML
  • Create and use modified templates to produce the
    HTML and RTF output.

HTLM
RTF
  • font
  • color
  • traffic lighting
  • heading text
  • data formats
  • order of columns
  • banner image (HTLM)
  • background image (HTML)
  • panels (RTF)
  • page orientation (RTF)

11
The Plan Step 1 - create procedure output as
text. Step 2 - create RTF and HTML output
with default templates.
12
  • The Plan
  • Step 3 - Part A - modify style template to
    specify
  • font
  • font size
  • landscape layout (RFT)
  • banner and background images (HTML).
  • Part B - apply new style template to create
    output.
  • Step 4 - Part A - modify table template for Proc
    Freq to specify
  • order and format of columns
  • header text
  • 2 panels per page (RTF)
  • traffic lighting.
  • Part B - apply new table template to create
    output.

13
ODS Output Production
Destination
Result
SASData Set Output Window HTMLFile RTF File
Output Listing HTML RTF
14
Step 1 - create procedure output as text.
proc report dataairline.rates(obs50) nowd
split' ' title 'Projected Ticket Rates'
columns rte_id _numeric_ define rte_id /
id run proc freq dataairline.employees
table JobCode title 'Counts by Job Code' run
15
Step 2 - create RTF and HTML output with
default templates.
ODS RTF filesomething.rtf ODS HTML
filesomething.html ltoriginal SAS code
producing outputgt ODS RFT CLOSE ODS HTML
CLOSE
16
Step 3 - Part A - modify style template to
specify font, font size, landscape layout (RFT),
and banner and background images (HTML).
PROC TEMPLATE DEFINE STYLE style-name
PARENTparent REPLACE
element1 attribute1value attribute2value
REPLACE element2 attribute1value
attribute2value ENDRUN
Element attribute
value
_ document background image something.gif column
headers text color blue background
color white font Lucidia Console cell
borders thickness 2 pixels color black
17
Step 3 - Part B - apply new style template to
create output.
ODS RTF filesomething.rtf stylenewstyle ODS
HTML filesomething.html stylenewstyle
ltoriginal SAS code producing outputgt ODS RFT
CLOSE ODS HTML CLOSE
18
Step 4 - Part A - modify table template for Proc
Freq to specify order and format of columns,
header text, 2 panels per page (RTF), and traffic
lighting.
PROC TEMPLATE EDIT TABLE template-name
MVAR COLUMN column(s)
DEFINE header
attribute1value END
EDIT column HEADER'label
text' FORMATformat.
other change statements END
ENDRUN
  • Attributes and values can be specified for
  • the entire table
  • table headers and footers
  • individual column headers and column values

19
Step 4 - Part B - apply new table template to
create output.
SAS matches up the data component of each output
object with the template component by name.
User modified table templates retain the same
name as the originals, but they are stored in a
different location. By default, SAS will find
and use the user defined table templates first.
No need to specify the new table template. An
ODS PATH statement can be used to control which
templates SAS is able to find and use.
20
  • Process
  • what do I want to change?
  • what are the corresponding style elements of the
    style template?
  • (and/or)
  • what is the name of the table template and the
    names of the headers or columns within that I
    want to change?
  • what particular attributes do I want to specify
    for these style elements, or for the tables,
    table headers, or table columns?
  • what are valid values to set for these
    attributes?
  • Everything in red italics has a specific name

21
The general structure of templates
style template
table template
header
footer
column
table
style elements
attributes
attributes
attributes
attributes
attributes
values
values
values
values
values
This is the forest. Dont get lost among the many
trees
22
Template inheritance
  • within a style template, elements inherit
    attributes and their values from other elements.
  • both style and table templates may also inherit
    elements and their attributes from other
    templates.

23
Inheritance within a style template
proc template define
style Styles.Default . . . . style
Container font Fonts('DocFont') foreground
colors('docfg') background colors('docbg')
style Index from Container
foreground colors('contentfg') background
colors('contentbg') . . . .
Inheritance from another style template
proc template
define style Styles.Rtf
parent
styles.printer
style titleAndNoteContainer from
titleAndNoteContainer / outputwidth
_undef_
replace cell from container /
linkcolor colors('link2')
24
Inheritance from another table template
proc template edit Base.Freq.OneWayFreqs
. . .
25
  • Help and documentation
  • SAS Online Doc - Guide to the Output Delivery
    System.
  • includes syntax
  • full lists of elements, attributes, and values.
  • (hardcopy useful)
  • Interactive Template Window and Template Browser
    Window.
  • get to know the default templates you need to
    work with
  • copy and paste required code.
  • Classroom Training Getting Started with the
    Output Delivery System.

26
Other references
  • URLs of Interest
  • www.sas.com/rnd/base/topics/
  • odsxml/xml.pdf
  • odsprinter/faq.html
  • odscss/
  • odsfordata/ods.pdf
  • style-template/style.html
  • v6v8ods/index.html
  • V7/V8 and ODS papers to download
  • http//ftp.sas.com/techsup/download/v7papers/
Write a Comment
User Comments (0)
About PowerShow.com