Essential ODS PDF Patrick Thornton.

Slides:



Advertisements
Similar presentations
Summary Statistics/Simple Graphs in SAS/EXCEL/JMP.
Advertisements

Getting the Right Report (Again): Your Compatibility Guide for ODS PDF 9.2 Bari Lawhorn and Scott Huntley, SAS Institute Inc., Cary, NC.
©2011, Veridical Solutions. SAS and all other SAS Institute Inc. product or service names are registered trademarks or trademarks of SAS Institute Inc.
Statistical Methods Lynne Stokes Department of Statistical Science Lecture 7: Introduction to SAS Programming Language.
Using ODS Regions to Create Custom Reports Kate Morrow, M.S. Statistician Vermont Oxford Network, Burlington, VT.
Outline Proc Report Tricks Kelley Weston. Outline Examples 1.Text that spans columnsText that spans columns 2.Patient-level detail in the titlesPatient-level.
Creating a Compact Columnar Output with PROC REPORT Walter R. Young Principal Clinical Programmer Analyst Wyeth.
How to Create a Custom Style Sonia Extremera / Antonio Nieto / Javier Gómez PhUSE Annual Conference, 9th-12th Oct 2011, Brighton UK.
MASUG December 5, Agenda Announcements Announcements Tips & Tricks Tips & Tricks Presentation: Presentation: Working Smarter, Not Harder with DDE:
Introduction to SPSS Allen Risley Academic Technology Services, CSUSM
SAS Output Delivery System. Find heart in the sashelp library Double click.
Get Fancy Department Level Reports Using SAS ExcelXP Tagset 2008 AIR Forum Seattle, Washington Ray Wallace Washington State University.
PROC_CODEBOOK: An Automated, General Purpose Codebook Generator
How to Build Tabular Dashboards Using Proc Report
The gchart Procedure The gchart Procedure is used to create bar charts of various types (it can also create pie charts. It’s most basic form would look.
Welcome to SAS…Session..!. What is SAS..! A Complete programming language with report formatting with statistical and mathematical capabilities.
“SAS macros are just text substitution!” “ARRRRGGHHH!!!”
SAS Macros ® 101 How I learned to stop worrying and love macros Alex Chaplin BCS USA Section.
A Concise Display of Multiple Response Items Patrick Thornton.
SAS PROC REPORT PROC TABULATE
Chapter 9 Producing Descriptive Statistics PROC MEANS; Summarize descriptive statistics for continuous numeric variables. PROC FREQ; Summarize frequency.
Introduction to SAS Essentials Mastering SAS for Data Analytics Alan Elliott and Wayne Woodward SAS ESSENTIALS -- Elliott & Woodward1.
Niraj J. Pandya, Element Technologies Inc., NJ.  Summarize all possible combinations of class level variables even if few categories are altogether missing.
Report Management Using the ODS DOCUMENT Destination and Report Metadata Brit Harvey February 2010.
My ODS: Real-World Uses of Modifying Table Templates Steve James Centers for Disease Control and Prevention Atlanta, Ga.
Multiple Uses for a Simple SQL Procedure Rebecca Larsen University of South Florida.
%rtf2data: A utility macro to convert RTF Table to SAS® dataset
Copyright © 2008 SAS Institute Inc. All rights reserved. SAS and all other SAS Institute Inc. product or service names are registered trademarks or trademarks.
PROC TEMPLATE: The Basics Lauren Haworth Genentech, Inc. South San Francisco, CA.
Copyright © 2004, SAS Institute Inc. All rights reserved. SAS is a registered trademark or trademark of SAS Institute Inc. in the USA and other countries.
01/20151 EPI 5344: Survival Analysis in Epidemiology SAS code and output February 24, 2015 Dr. N. Birkett, School of Epidemiology, Public Health & Preventive.
Macro Overview Mihaela Simion. Macro Facility Overview Definition : The SAS Macro Facility is a tool within base SAS software that contains the essential.
1 SAS 1-liners SAS Coding Efficiencies. 2 Overview Less is more Always aim for robust, reusable and efficient code Coding efficiency versus processing.
SAS Software Version 8 The Output Delivery System.
Working with Templates Lesson 6. Skills Matrix SKILL #MATRIX SKILL 1.1.1Work with templates 1.1.6Insert blank pages or cover pages.
Using the new Version 8 Template Procedure for Complete Control of SAS Output Style and Format David Ghan Technical Training Specialist SAS, Canada.
Introduction to Enterprise Guide Jennifer Schmidt Rhonda Ellis Cassandra Hall.
Introduction to SAS Essentials Mastering SAS for Data Analytics Alan Elliott and Wayne Woodward SAS ESSENTIALS -- Elliott & Woodward1.
SAS ODS (Output Delivery System) Donald Miller 812 Oswald Tower ;
Priya Ramaswami Janssen R&D US. Advantages of PROC REPORT -Very powerful -Perform lists, subsets, statistics, computations, formatting within one procedure.
Copyright © 2005, SAS Institute Inc. All rights reserved. SAS is a registered trademark or trademark of SAS Institute Inc. in the USA and other countries.
Computing with SAS Software A SAS program consists of SAS statements. 1. The DATA step consists of SAS statements that define your data and create a SAS.
FORMAT statements can be used to change the look of your output –if FORMAT is in the DATA step, then the formats are permanent and stored with the dataset.
1 Chapter 3: Getting Started with Tasks 3.1 Introduction to Task Dialogs 3.2 Creating a Listing Report 3.3 Creating a Frequency Report 3.4 Creating a Two-Way.
Customize SAS Output Using ODS Joan Dong. The Output Delivery System (ODS) gives you greater flexibility in generating, storing, and reproducing SAS procedure.
1 PEER Session 02/04/15. 2  Multiple good data management software options exist – quantitative (e.g., SPSS), qualitative (e.g, atlas.ti), mixed (e.g.,
Patrick Thornton SRI International.  Example of a Multiple Response Item ◦ Variable coding and example data  A Cross Tabulation using Proc REPORT 
Chapter 15: Spreadsheet and Worksheet Basics – Lesson 92 © 2010, 2006 South-Western, Cengage Learning.
Based on Learning SAS by Example: A Programmer’s Guide Chapters 1 & 2
Copyright © 2008, SAS Institute Inc. All rights reserved. SAS and all other SAS Institute Inc. product or service names are registered trademarks or trademarks.
1 SAS ® ODS Technology for Today’s Decision Makers Sunil Gupta Quintiles.
SAS ® 101 Based on Learning SAS by Example: A Programmer’s Guide Chapters 14 & 19 By Tasha Chapman, Oregon Health Authority.
Lesson 16-Templates and Wizards. Overview Use Word templates. Create new templates. Attach templates to documents. Modify templates. Use the Organizer.
Build your Metadata with PROC CONTENTS and ODS OUTPUT Louise S. Hadden Abt Associates Inc.
Better Metadata Through SAS® II: %SYSFUNC, PROC DATASETS, and Dictionary Tables.
SAS ® 101 Based on Learning SAS by Example: A Programmer’s Guide Chapters 16 & 17 By Tasha Chapman, Oregon Health Authority.
Android Online Training AcuteSoft: India: , Land Line: +91 (0) USA: , UK : +44.
Tips for Mastering Relational Databases Using SAS/ACCESS®
Chapter 5: Enhancing Your Output with ODS
Applied Business Forecasting and Regression Analysis
Poster Title Author #1 name, ABC Corporation, City, Country Author #2 name, ABC Corporation, City, Country Abstract A brief abstract at the beginning summarizes.
Jonathan W. Duggins; James Blum NC State University; UNC Wilmington
SAS Data Set Utility with Excel Output
Poster Title Author #1 name, ABC Corporation, City, Country Author #2 name, ABC Corporation, City, Country Abstract A brief abstract at the beginning summarizes.
Tamara Arenovich Tony Panzarella
PROC DOC III: Self-generating Codebooks Using SAS®
Never Cut and Paste Again
Automating SAS through the Power of VB Script
Introduction to SAS Essentials Mastering SAS for Data Analytics
Introduction to SAS Essentials Mastering SAS for Data Analytics
Presentation transcript:

Essential ODS PDF Patrick Thornton

About this Presentation ODS PDF capabilities I’ve found most valuable Upper case indicates SAS syntax, e.g. PROC Lower case indicates names of my choosing Red indicates syntax of specific interest … indicates syntax has been excluded to save space

Essential ODS PDF: Outline Creating a PDF Setting page options, titles and footnotes Capturing results from PROCs as data Selecting or excluding PROC results Simultaneously creating multiple PDFs Example incorporating PROC REPORT

Creating a PDF ODS PDF FILE= "&sasexport.example1.pdf"; PROC FREQ DATA=services; TABLE t1_1; RUN; ODS PDF CLOSE;

Creating a PDF: Summary of Options Name it with: File = Control the overall look with: Style = Add metadata with: Author=, Title=, Subject=, Keywords= Consolidate the output with: Startpage=, Columns= Simultaneously create two PDF with: Id =

Creating a PDF: Style ODS PDF FILE="&sasexport.example2.pdf" STYLE=OCEAN; PROC FREQ DATA=services; TABLE t1_1; RUN; ODS PDF CLOSE;

Creating a PDF: Style Listing PROC TEMPLATE; LIST STYLES; RUN; e.g. SASDOCPRINTER, MINIMAL

Creating a PDF: Customize a Style PROC TEMPLATE; DEFINE STYLE myocean; PARENT= styles.ocean; REPLACE TABLE FROM OUTPUT/ FRAME = void RULES = rows CELLPADDING = 3pt CELLSPACING = 0.0pt BORDERWIDTH = 0.2pt; END; RUN;

Creating a PDF: Customize a Style (con’t) ODS PDF FILE="&sasexport.example2a.pdf" STYLE=myocean; PROC FREQ DATA=services; TABLE t1_1; RUN; ODS PDF CLOSE;

Creating a PDF: Customize a Style (con’t)

Creating a PDF: Summary of Options Name it with: File = Control the overall look with: Style = Add metadata with: Author=, Title=, Subject=, Keywords= Consolidate the output with: Startpage=, Columns= Simultaneously create two PDF with: Id =

Creating a PDF: Metadata

Creating a PDF: Metadata (con’t)

Creating a PDF: Metadata (con’t)

Creating a PDF: Metadata (con’t)

Creating a PDF: Metadata %LET programname = %SYSGET(SAS_EXECFILENAME); %LET mytitle = My Ocean Style PDF with KEYWORDS; ODS PDF FILE="&sasexport.&mytitle..pdf" KEYWORDS="&programname example3"; PROC FREQ … ODS PDF CLOSE;

Creating a PDF: Summary of Options Name it with: File = Control the overall look with: Style = Add metadata with: Author=, Title=, Subject=, Keywords= Consolidate the output with: Startpage=, Columns= Simultaneously create two PDF with: Id =

Creating a PDF: Consolidating ODS PDF FILE="&sasexport.example4.pdf" STYLE=OCEAN; PROC FREQ DATA=services; TABLE t1_1 * t2_1/AGREE; RUN; …PROC t1_2*t2_2, t1_3*t2_3, t1_4*t2_4 ODS PDF CLOSE;

Creating a PDF: Consolidating ODS PDF FILE="&sasexport.example4b.pdf" STYLE=OCEAN COLUMNS=2 ; ODS NOPROCTITLE; PROC FREQ DATA=services NOTITLE; TABLE t1_1 * t2_1/AGREE; RUN; [repeat PROC t1_2*t2_2, t1_3*t2_3, t1_4*t2_4] ODS PDF CLOSE;

Essential ODS PDF: Outline Creating a PDF Setting page options, titles and footnotes Capturing results from PROCs as data Selecting or excluding PROC results Simultaneously creating multiple PDFs Example incorporating PROC REPORT

Options, Titles and Footnotes Remove date with: NODATE Remove page number with: NONUMBER Set orientation with ORIENTATION= In line styles TITLE and FOOTNOTE: Set size with HEIGHT= Set horizontal position with J= Set font with F= Customize with ODS ESCAPECHAR=

Options, Titles & Footnotes (con’t) OPTIONS ORIENTATION=LANDSCAPE NODATE NONUMBER ; TITLE1 HEIGHT=12PT J=LEFT F=ARIAL "Modifying OPTIONS"; FOOTNOTE1 HEIGHT=8PT J=RIGHT F=ARIAL "Page ^{thispage} of ^{lastpage} "; ODS PDF FILE="&sasexport.example5.pdf“ STYLE=…; ODS ESCAPECHAR='^‘ ; ODS NOPROCTITLE; PROC FREQ… ODS PDF CLOSE;

Options, Titles & Footnotes (con’t) %macro repnow ; %local d t ; %let d = %sysfunc( date( ), weekdate29 ); %let t = %sysfunc( time( ), timeampm8 ); &t &d %mend repnow; %let ff = HEIGHT=8PT J=RIGHT F=ARIAL; FOOTNOTE1 &ff "Page ^{thispage} of ^{lastpage}"; FOOTNOTE2 &ff "%repnow";

Essential ODS PDF: Outline Creating a PDF Setting page options, titles and footnotes Capturing results from PROCs as data Selecting or excluding PROC results Simultaneously creating multiple PDFs Example incorporating PROC REPORT

PROC Results to Data: TRACE ODS TRACE ON; PROC FREQ DATA=services; TABLE t1_1 * t2_1; RUN; ODS TRACE OFF; Partial Log Output Name: CrossTabFreqs

PROC Results to Data: TRACE (con’t) ODS TRACE ON; PROC FREQ DATA=services; TABLE t1_1 * t2_1/AGREE ; RUN; ODS TRACE OFF; Log Output Names CrossTabFreqs McNemarsTest SimpleKappa

PROC Results to Data: Output ODS OUTPUT CROSSTABFREQS= CrossTabFreqs MCNEMARSTEST = McNemarsTest; PROC FREQ DATA=services; TABLE t1_1 * t2_1/AGREE; RUN; ODS OUTPUT CLOSE;

Essential ODS PDF: Outline Creating a PDF Setting page options, titles and footnotes Capturing results from PROCs as data Selecting or excluding PROC results Simultaneously creating multiple PDFs Example incorporating PROC REPORT

Selecting or Excluding PROC Results ODS PDF FILE="&sasexport.Example 6.pdf" …; ODS PDF SELECT WHERE=(_NAME_ in ('CrossTabFreqs')); PROC FREQ DATA=services; TABLE t1_1 * t2_1/AGREE; RUN; ODS PDF CLOSE;

Simultaneously creating multiple PDFs ODS PDF (ID=long) FILE="&sasexport.Example 7a.pdf" ; ODS PDF (ID=short) FILE="&sasexport.Example 7b.pdf" STYLE=OCEAN; ODS PDF (ID=short) EXCLUDE WHERE=(_name_ in ('SimpleKappa')); PROC FREQ DATA=services NOTITLE; TABLE t1_1 * t2_1/AGREE; RUN; ODS PDF (ID=short) CLOSE; ODS PDF (ID=long) CLOSE;

Example: SELECT/EXCLUDE & OUTPUT ODS PDF (ID=lis) FILE="&sasexport.Example 8a.pdf" ; ODS PDF (ID=nice) FILE="&sasexport.Example 8b.pdf" STYLE=OCEAN; ODS PDF (ID=nice) EXCLUDE _ALL_; ODS OUTPUT CROSSTABFREQS= CrossTabFreqs (rename=(t1_1=var1 t2_1=var2)) MCNEMARSTEST = McNemarsTest; PROC FREQ DATA=services; TABLE t1_1 * t2_1/AGREE; RUN; ODS OUTPUT CLOSE; ODS PDF (ID=lis) EXCLUDE _ALL_; ODS PDF (ID=nice) SELECT WHERE=(_NAME_ in (‘Report’));

Example: McNemar’s Test PROC SQL NOPRINT; SELECT CATX('=',label1,cvalue1) INTO: mc SEPARATED BY ‘ ' FROM McNemarsTest; QUIT; %PUT &mc; Statistic (S)=5.6667 DF=1 Pr > S=0.0173

Example: Marginal N and Percent from CrossTabFreqs data CrossTabFreqs; set CrossTabFreqs; if var1 = . then onevalue = var2; else if var2 = . then onevalue = var1 ; if (_type_ ='01' and var1 =.) or (_type_ ='10' and var2 =. ); run;

Example: Cross Tab Freqs

Example: SELECT/EXCLUDE & OUTPUT ODS PDF (ID=lis) FILE="&sasexport.Example 8a.pdf" ; ODS PDF (ID=nice) FILE="&sasexport.Example 8b.pdf" STYLE=OCEAN; ODS PDF (ID=nice) EXCLUDE _ALL_; ODS OUTPUT CROSSTABFREQS= CrossTabFreqs (rename=(t1_1=var1 t2_1=var2)) MCNEMARSTEST = McNemarsTest; PROC FREQ DATA=services; TABLE t1_1 * t2_1/AGREE; RUN; ODS OUTPUT CLOSE; ODS PDF (ID=lis) EXCLUDE _ALL_; ODS PDF (ID=nice) SELECT WHERE=(_NAME_ in (‘Report’));

Example: PROC REPORT …PROC SQL to capture McNemar’s Test …DATA step to limit CrossTabFreqs and create variable onevalue PROC REPORT DATA=CrossTabFreqs nowd MISSING; COL ("Table 1 Caregiver Mental Health Need" onevalue (_TYPE_), (frequency percent) ); DEFINE onevalue /GROUP 'Responses' STYLE=[CELLWIDTH=200] CENTER; DEFINE _TYPE_ /ACROSS FORMAT=$timetype. ""; DEFINE FREQUENCY/ 'n' STYLE=[CELLWIDTH=70]; DEFINE PERCENT/'%' STYLE=[CELLWIDTH=70] FORMAT=5.1;

Example: PROC REPORT (CON’T) PROC REPORT … RBREAK AFTER / OL SKIP SUMMARIZE SUPPRESS; COMPUTE AFTER _PAGE_ /; LINE “&mc"; ENDCOMP; FORMAT onevalue yn.; RUN;; ODS PDF (ID=lis) CLOSE; ODS PDF (ID=nice) CLOSE;

Example: Final Output

Essential ODS PDF:Conclusion Creating a PDF Setting page options, titles and footnotes Capturing results from PROCs as data Selecting or excluding PROC results Simultaneously creating multiple PDFs Example incorporating PROC REPORT

SAS® The Power To Know™ SAS is a registered trademark or trademark of SAS Institute Inc. in the USA and other countries. ® indicates USA registration. Other brand and product names are registered trademarks or Trademarks of their respective companies.

Contact Information Patrick Thornton, Ph.D. 333 Ravenswood Ave Menlo Park, CA 94025-3493 650 859-5583 Patrick.thornton@sri.com