ODS Advanced Topics ODS is constantly improving support

  • Slides: 41
Download presentation
ODS: Advanced Topics

ODS: Advanced Topics

ODS is constantly improving support. sas. com/base/rnd

ODS is constantly improving support. sas. com/base/rnd

ODS Tip Sheets • On R&D site: – ODS Basics and ODS HTML –

ODS Tip Sheets • On R&D site: – ODS Basics and ODS HTML – ODS PDF – ODS RTF – Using ODS Style Syntax with PROC PRINT, REPORT and TABULATE – Style Template Syntax – Table Template Syntax – ODS DOCUMENT

Beyond The Basics: Custom HTML too small not italic too big

Beyond The Basics: Custom HTML too small not italic too big

Beyond The Basics: Custom HTML ODS HTML BODY='overtime. html'; title '<H 1>Overtime Billing for

Beyond The Basics: Custom HTML ODS HTML BODY='overtime. html'; title '<H 1>Overtime Billing for Contract Job Type</H 1>'; footnote '<FONT SIZE=2>Overtime defined as >10 hours</FONT>'; proc print data=Billings noobs label where Hours>8; label Hours='<I>Overtime Hours</I>'; var Work. Date Job. Type Hours; run; ODS HTML CLOSE;

Beyond The Basics: Custom HTML bigger italic smaller

Beyond The Basics: Custom HTML bigger italic smaller

Adding Page X of Y to RTF Reports OPTIONS NONUMBER; ODS ESCAPECHAR='^'; title justify=center

Adding Page X of Y to RTF Reports OPTIONS NONUMBER; ODS ESCAPECHAR='^'; title justify=center 'Data Set CLIPS' justify=right 'Page ^{pageof}';

Adding Page X of Y to RTF Reports Alt-F 9

Adding Page X of Y to RTF Reports Alt-F 9

Adding Page X of Y to RTF Reports • To get a different format,

Adding Page X of Y to RTF Reports • To get a different format, use thispage and lastpage instead of pageof title justify=center 'Data Set CLIPS‘ justify=right 'Page ^{thispage}/^{lastpage}';

Adding a Static Dates • To insert the date the program was run ODS

Adding a Static Dates • To insert the date the program was run ODS RTF FILE='Static. Date. rtf' SASDATE;

Adding Text ODS TEXT ‘Insert your text’;

Adding Text ODS TEXT ‘Insert your text’;

Adding Text ODS ESCAPECHAR='^'; ODS RTF FILE='Add. Text. rtf' STARTPAGE=OFF; * procedure goes here;

Adding Text ODS ESCAPECHAR='^'; ODS RTF FILE='Add. Text. rtf' STARTPAGE=OFF; * procedure goes here; ODS TEXT='^S={LEFTMARGIN=1 in RIGHTMARGIN=1 in} This text was inserted with the TEXT= option. It can be used to add a detailed explanatory caption below a table or figure. This example uses an inline formatting escape sequence to apply different styles here. This text can also be formatted by using PROC TEMPLATE and the usertext style element'; ODS RTF CLOSE;

Adding Text

Adding Text

Beyond the Basics: Adding More Complex Text ODS ESCAPECHAR='^'; ODS RTF FILE='Report. With. Text.

Beyond the Basics: Adding More Complex Text ODS ESCAPECHAR='^'; ODS RTF FILE='Report. With. Text. rtf' STARTPAGE=OFF; ODS RTF TEXT='^{style[font_style=italic fontweight=bold fontsize=14 pt] This bold, italicized text in 14 pt introduces the table. Use ^n^n to insert blank lines to start a new paragraph}'; * proc corr goes here; ODS RTF TEXT='^n^n^S={font=(Arial)} This sentence in Arial says that four lines were inserted before this sentence and that a bar chart follows: '; * proc gchart goes here; ODS RTF TEXT='^S={fontweight=bold textdecoration=underline}This bold, underlined sentence concludes the report. '; ODS RTF CLOSE;

Beyond the Basics: Adding More Complex Text

Beyond the Basics: Adding More Complex Text

Beyond the Basics: Adding Hyperlinks to RTF Output ODS ESCAPECHAR=’^’; ODS RTF FILE='Hyperlink. rtf';

Beyond the Basics: Adding Hyperlinks to RTF Output ODS ESCAPECHAR=’^’; ODS RTF FILE='Hyperlink. rtf'; proc freq data=clips; table compete; run; ODS RTF TEXT='^S={URL="http: //www. myweb. com"}Source: ^S={FOREGROUND=blue}www. myweb. com'; ODS RTF CLOSE;

Beyond the Basics: Adding Hyperlinks to RTF Output

Beyond the Basics: Adding Hyperlinks to RTF Output

Adding a Table of Contents ODS RTF FILE='Payroll. TOC. rtf' CONTENTS=yes TOC_DATA;

Adding a Table of Contents ODS RTF FILE='Payroll. TOC. rtf' CONTENTS=yes TOC_DATA;

Adding a Table of Contents ODS RTF FILE='Payroll. TOC. rtf' CONTENTS=yes TOC_DATA; ODS PROCLABEL

Adding a Table of Contents ODS RTF FILE='Payroll. TOC. rtf' CONTENTS=yes TOC_DATA; ODS PROCLABEL 'Human Resources Report on Salary and Hours'; proc tabulate data=hr; class department category; var annualsalary hoursweek; tables department='Annual Salary Statistics for ' all='Annual Salary Statistics in All Departments and Categories', (category all='All Categories in Department'), annualsalary*( (n mean min median max)*f=dollar 8. ); tables department='Hours per Week Statistics for ' all= 'Hours per Week Statistics for All Departments and Categories', (category all='All Categories in Department'), hoursweek*( (n mean min median max)*f=3. ); run; ODS RTF CLOSE;

Adding a Table of Contents To generate the TOC: right click on TOC and

Adding a Table of Contents To generate the TOC: right click on TOC and select “update field”. If TOC not showing, click View and then “Show Paragraph Marks”.

Adding a Table of Contents • How it works:

Adding a Table of Contents • How it works:

Beyond the Basics: Enhancing RTF using RTF Control Words and Field Codes Style RTF

Beyond the Basics: Enhancing RTF using RTF Control Words and Field Codes Style RTF Control Word(s) Quoted String in TITLE or FOOTNOTE Statement Bold Italicize b i "bi 0 Bold b 0 i Italicize" Bullet bullet "bullet Bullet" Double strike striked 1 "striked 1 Double Strike striked 0 Regular Words" Double underline dul "uldb Double Underline uldb 0" Engrave impr "impr Engrave" Subscript sub "Subscript sub 1" Superscript super "Superscript super 2" Outline outl "outl Outline" Shadow shad "shad Shadow" Foreground color cfn "cf 1 Foreground 1 cf 2 Foreground 2 cf 3 Foreground 3" Wave underline ulw "ulwave Wave underline"; Thick underline ulth "ulth Thick Underline" Font size in half points fs 24 "fs 48 Font Size in half points size 48 will be 24 pt in the document" title "^{raw <string>}";

Beyond the Basics: Enhancing RTF using RTF Control Words and Field Codes

Beyond the Basics: Enhancing RTF using RTF Control Words and Field Codes

Creating bookmarks in your PDF file title 'Analysis of Consumer Complaints'; ODS PDF FILE='Complaint.

Creating bookmarks in your PDF file title 'Analysis of Consumer Complaints'; ODS PDF FILE='Complaint. Analysis. pdf'; proc glm data=Complaints; class product location; model Num. Complaints=Product Location; run; ODS PDF CLOSE; Bookmarks are automatic – no code change needed!

Creating bookmarks in your PDF file

Creating bookmarks in your PDF file

Creating bookmarks in your PDF file title 'Analysis of Consumer Complaints'; ODS PDF FILE='Complaint.

Creating bookmarks in your PDF file title 'Analysis of Consumer Complaints'; ODS PDF FILE='Complaint. Analysis. pdf'; ODS PROCLABEL ’Analysis of Consumer Complaints’; proc glm data=Complaints; class product location; model Num. Complaints=Product Location; run; ODS PDF CLOSE;

Creating bookmarks in your PDF file Bookmark options: check out CONTENTS, PDFTOC, BOOKMARKGEN and

Creating bookmarks in your PDF file Bookmark options: check out CONTENTS, PDFTOC, BOOKMARKGEN and BOOKMARKLIST

Creating PDF with hyperlinks and annotations ODS PDF FILE='Annotated. Report. pdf'; proc report data=gallery

Creating PDF with hyperlinks and annotations ODS PDF FILE='Annotated. Report. pdf'; proc report data=gallery nowd; column artist medium price; define artist / group STYLE(Header)= {URL="http: //www. artistlookupwebsite. com/"}; define medium / group STYLE(Header)= {URL="http: //www. artistmediumlookup. com"}; define price / analysis mean STYLE(Header)= {FLYOVER="Prices listed in US$"}; run; ODS PDF CLOSE;

Creating PDF with hyperlinks and annotations

Creating PDF with hyperlinks and annotations

Creating PDF with hyperlinks and annotations

Creating PDF with hyperlinks and annotations

Another means of creating hyperlinks and annotations ODS ESCAPECHAR='^'; ODS PDF FILE='Hyperlinked. Report. pdf';

Another means of creating hyperlinks and annotations ODS ESCAPECHAR='^'; ODS PDF FILE='Hyperlinked. Report. pdf'; footnote '^{style[URL="http: //threeartgalleries. info"]Click for more gallery info}'; proc tabulate data=gallery; class gallery; var price; tables gallery, price* (n*f=5. (mean min max)*f=dollar 8. ); run; ODS PDF CLOSE;

Another means of creating hyperlinks and annotations

Another means of creating hyperlinks and annotations

Another means of creating hyperlinks and annotations ODS ESCAPECHAR='^'; proc format; value $galft 'East

Another means of creating hyperlinks and annotations ODS ESCAPECHAR='^'; proc format; value $galft 'East Side'='^{style[FLYOVER= "130 East 23 rd"]East side}‘ 'Downtown'='^{style[FLYOVER= "10 Elm Street"]Downtown}‘ 'Mall'='^{style[FLYOVER= "Southside Mall Blvd"]Mall}'; run;

Another means of creating hyperlinks and annotations

Another means of creating hyperlinks and annotations

Adding Page X of Y to PDF ODS ESCAPECHAR='^'; ODS PDF FILE="Footnotes. pdf"; footnote

Adding Page X of Y to PDF ODS ESCAPECHAR='^'; ODS PDF FILE="Footnotes. pdf"; footnote justify=left 'Page ^{thispage} of ^{lastpage}'; footnote 2 'Page -^{thispage}-' ; footnote 3 'Total Pages: ^{lastpage}'; footnote 5 justify=left 'Seite ^{thispage} von ^{lastpage}'; footnote 7 justify=left 'Página ^{thispage} de ^{lastpage}'; footnote 8 '^{pageof}'; proc print data=gallery(obs=20); run; ODS PDF CLOSE;

Adding Page X of Y to PDF Doesn’t work for PDF, only RTF

Adding Page X of Y to PDF Doesn’t work for PDF, only RTF

Tagsets and Reporting

Tagsets and Reporting

Tagsets and Reporting

Tagsets and Reporting

Tagsets and Reporting

Tagsets and Reporting

Further reading: SGF papers • http: //support. sas. com/rnd/base/ods/od smarkup/pandp. html – ODS Markup

Further reading: SGF papers • http: //support. sas. com/rnd/base/ods/od smarkup/pandp. html – ODS Markup and Tagsets, a Tutorial – ODS and Office Integration – ODS MARKUP: The SAS Reports You've Always Dreamed Of

Summary • This was a whirlwind tour of some useful advanced topics • There

Summary • This was a whirlwind tour of some useful advanced topics • There are many more • Questions: – info@laurenhaworth. com – Or buy the book!