Presentation is loading. Please wait.

Presentation is loading. Please wait.

Using the new Version 8 Template Procedure for Complete Control of SAS Output Style and Format David Ghan Technical Training Specialist SAS, Canada.

Similar presentations


Presentation on theme: "Using the new Version 8 Template Procedure for Complete Control of SAS Output Style and Format David Ghan Technical Training Specialist SAS, Canada."— Presentation transcript:

1 Using the new Version 8 Template Procedure for Complete Control of SAS Output Style and Format David Ghan Technical Training Specialist SAS, 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)

4 ODS Destinations Report Destinations ListingHTML Printer Data Destination Output RTF

5 Output Listing HTML RTF Destination Output Object Data Component Template Components SAS Data Set Output Window HTML File RFT File Result ODS Output Production * 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 style template table template style elements attributes values table header footercolumn attributes values attributes values attributes values attributes values The general structure of templates

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. 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 ƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒ BAGCLK 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 (cont’d) standard templates Create the SAS output in HTML format and RTF (Rich Text Format) using standard templates supplied by SAS. heading text data formats order of columns banner image banner image (HTLM) background image background image (HTML) panels (RTF) page orientation (RTF) modified templates Create and use modified templates to produce the HTML and RTF output. font color traffic lighting

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 Output Listing HTML RTF Destination Output Object Data Component Template Components SAS Data Set Output Window HTML File RTF File Result ODS Output Production proc report, proc freq style template, table template

14 Step 1 - create procedure output as text. proc report data=airline.rates(obs=50) nowd split=' '; title 'Projected Ticket Rates'; columns rte_id _numeric_; define rte_id / id; run; proc freq data=airline.employees; table JobCode; title 'Counts by Job Code'; run;

15 ODS RTF file=‘something.rtf’; ODS HTML file=‘something.html’; ODS RFT CLOSE; ODS HTML CLOSE; Step 2 - create RTF and HTML output with “default” templates.

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; PARENT=parent; REPLACE element1 attribute1=value attribute2=value …; REPLACE element2 attribute1=value attribute2=value …; END; RUN; Element attribute value _ documentbackground imagesomething.gif column headerstext colorblue background colorwhite fontLucidia Console cell bordersthickness2 pixels colorblack

17 Step 3 - Part B - apply new style template to create output. ODS RTF file=‘something.rtf’ style=newstyle; ODS HTML file=‘something.html’ style=newstyle; 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; attribute1=value …; END; EDIT column; HEADER='label text'; FORMAT=format.; … other change statements… END; END; RUN; 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 style template table template style elements attributes values table header footercolumn attributes values attributes values attributes values attributes values The general structure of templates This is the forest. Don’t 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 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');.. proc template; define style Styles.Rtf; parent = styles.printer; style titleAndNoteContainer from titleAndNoteContainer / outputwidth = _undef_; replace cell from container / linkcolor = colors('link2'); Inheritance within a style template: Inheritance from another style template:

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/


Download ppt "Using the new Version 8 Template Procedure for Complete Control of SAS Output Style and Format David Ghan Technical Training Specialist SAS, Canada."

Similar presentations


Ads by Google