SAS ® 101 Based on Learning SAS by Example: A Programmer’s Guide Chapters 14 & 19 By Tasha Chapman, Oregon Health Authority.

Slides:



Advertisements
Similar presentations
The essentials managers need to know about Excel
Advertisements

Microsoft Excel 2010 ® ® Tutorial 6: Managing Multiple Worksheets and Workbooks.
Understanding Microsoft Excel
EXCEL Spreadsheet Basics
Creating a Compact Columnar Output with PROC REPORT Walter R. Young Principal Clinical Programmer Analyst Wyeth.
® Microsoft Office 2010 Word Tutorial 3 Creating a Multiple-Page Report.
How to Create a Custom Style Sonia Extremera / Antonio Nieto / Javier Gómez PhUSE Annual Conference, 9th-12th Oct 2011, Brighton UK.
Developing Effective Reports
1 Chapter 3: Getting Started with Tasks 3.1 Introduction to Tasks and Wizards 3.2 Creating a Frequency Report 3.3 Generating HTML, PDF, and RTF Output.
Welcome to SAS…Session..!. What is SAS..! A Complete programming language with report formatting with statistical and mathematical capabilities.
Word Tutorial 3 Creating a Multiple-Page Report
“SAS macros are just text substitution!” “ARRRRGGHHH!!!”
Laboratory Exercise # 13 – Font and Number Format Styles Office Productivity Tools 1 Laboratory Exercise # 13 Font and Number Format Styles Objectives:
Copyright © 2010, Meta-Xceed, Inc. All rights reserved. BI Flash and all other Meta-Xceed Inc. product or service names are registered trademarks or trademarks.
Developing Effective Reports
Lesson 1 – Microsoft Excel The goal of this lesson is for students to successfully explore and describe the Excel window and to create a new worksheet.
Copyright © Texas Education Agency, All rights reserved. 1 Web Technologies Website Development with Dreamweaver.
XP New Perspectives on Microsoft Access 2002 Tutorial 51 Microsoft Access 2002 Tutorial 5 – Enhancing a Table’s Design, and Creating Advanced Queries and.
Introduction to SAS Essentials Mastering SAS for Data Analytics Alan Elliott and Wayne Woodward SAS ESSENTIALS -- Elliott & Woodward1.
XP Chapter 5 Succeeding in Business with Microsoft Office Access 2003: A Problem-Solving Approach 1 Developing Effective Reports Chapter 5 “Nothing succeeds.
11 Exploring Microsoft Office Excel 2007 Chapter 4: Working with Large Worksheets and Tables Chapter 04 - Lecture Notes (CSIT 104)
October 2003Bent Thomsen - FIT 3-21 IT – som værktøj Bent Thomsen Institut for Datalogi Aalborg Universitet.
European Computer Driving Licence Syllabus version 5.0 Module 4 – Spreadsheets Chapter 22 – Functions Pass ECDL5 for Office 2007 Module 4 Spreadsheets.
1 Data List Spreadsheets or simple databases - a different use of Spreadsheets Bent Thomsen.
Essential ODS PDF Patrick Thornton.
Teacher’s Assessment Assistant Worksheet Builder Starting the Program
Chapter 1: Introduction to SAS  SAS programs: A sequence of statements in a particular order  Rules for SAS statements: –Every SAS statement ends in.
Understanding Excel Lesson 1.
01/20151 EPI 5344: Survival Analysis in Epidemiology SAS code and output February 24, 2015 Dr. N. Birkett, School of Epidemiology, Public Health & Preventive.
M AKE E ASY S TYLE T EMPLATES U SING SAS M ACRO Barbara Harlan.
SAS Software Version 8 The Output Delivery System.
Introduction to SAS/Graph 9.2 Ken Barz Colorado Prevention Center 22Oct2009 Ken Barz Colorado Prevention Center.
IC 3 BASICS, Internet and Computing Core Certification Key Applications Lesson 11 Organizing the Worksheet.
Computer Literacy BASICS: A Comprehensive Guide to IC 3, 5 th Edition Lesson 19 Organizing and Enhancing Worksheets 1 Morrison / Wells / Ruffolo.
Using the new Version 8 Template Procedure for Complete Control of SAS Output Style and Format David Ghan Technical Training Specialist SAS, Canada.
Define your Own SAS® Command Line Commands Duong Tran – Independent Contractor, London, UK Define your Own SAS® Command Line Commands Duong Tran – Independent.
Introduction to Enterprise Guide Jennifer Schmidt Rhonda Ellis Cassandra Hall.
SAS ODS (Output Delivery System) Donald Miller 812 Oswald Tower ;
1 Data Manipulation (with SQL) HRP223 – 2010 October 13, 2010 Copyright © Leland Stanford Junior University. All rights reserved. Warning: This.
Priya Ramaswami Janssen R&D US. Advantages of PROC REPORT -Very powerful -Perform lists, subsets, statistics, computations, formatting within one procedure.
1 CA201 Word Application Arranging and Printing Documents Week # 4 By Tariq Ibn Aziz Dammam Community college.
1 Lesson 13 Organizing and Enhancing Worksheets Computer Literacy BASICS: A Comprehensive Guide to IC 3, 3 rd Edition Morrison / Wells.
Chapter 4 concerns various SAS procedures (PROCs). Every PROC operates on: –the most recently created dataset –all the observations –all the appropriate.
McGraw-Hill/Irwin The Interactive Computing Series © 2002 The McGraw-Hill Companies, Inc. All rights reserved. Microsoft Excel 2002 Working with Data Lists.
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.
Key Applications Module Lesson 22 — Managing and Reporting Database Information Computer Literacy BASICS.
XP New Perspectives on Microsoft Office Access 2003, Second Edition- Tutorial 6 1 Microsoft Office Access 2003 Tutorial 6 – Creating Custom Forms.
1 Data Manipulation (with SQL) HRP223 – 2009 October 12, 2009 Copyright © Leland Stanford Junior University. All rights reserved. Warning: This.
ODS TAGSETS - a Powerful Reporting Method Derek. 2 Agenda Understanding the tagset How to use tagsets Conclusion.
Based on Learning SAS by Example: A Programmer’s Guide Chapters 1 & 2
SAS ® 101 Based on Learning SAS by Example: A Programmer’s Guide Chapter 26 By Tasha Chapman, Oregon Health Authority.
Desktop Publishing Lesson 3 — Formatting Pages. Lesson 3 – Formatting Pages2 Objectives  Set up pages.  Set guides.  Use master pages.  Insert page.
1 SAS ® ODS Technology for Today’s Decision Makers Sunil Gupta Quintiles.
Microsoft Excel 2007 Noris Bt. Ismail Faculty of Information and Communication Technology Tel : (Ext 8408) BCOMP0101.
Build your Metadata with PROC CONTENTS and ODS OUTPUT Louise S. Hadden Abt Associates Inc.
SAS ® 101 Based on Learning SAS by Example: A Programmer’s Guide Chapters 16 & 17 By Tasha Chapman, Oregon Health Authority.
SAS ® 101 Based on Learning SAS by Example: A Programmer’s Guide Chapters 5 & 6 By Ravi Mandal.
A MORE COMPLETE ODS REPORT. What we’re going to talk about…  Creating a title page  Creating an introduction page  Creating long-form text descriptions.
SAS ® 101 Based on Learning SAS by Example: A Programmer’s Guide Chapters 3 & 4 By Tasha Chapman, Oregon Health Authority.
Using SAS to Create Multi-Sheet Excel Workbooks
Chapter 5: Enhancing Your Output with ODS
Microsoft Excel.
Instructor: Raul Cruz-Cano
Tamara Arenovich Tony Panzarella
Chapter 4: Sorting, Printing, Summarizing
Introduction to SAS A SAS program is a list of SAS statements executed in order Every SAS statement ends with a semicolon! SAS statements can be in caps.
Beautiful PROC CONTENTS Output Using the ODS Excel Destination
Lesson 19 Organizing and Enhancing Worksheets
Introduction to SAS Essentials Mastering SAS for Data Analytics
Presentation transcript:

SAS ® 101 Based on Learning SAS by Example: A Programmer’s Guide Chapters 14 & 19 By Tasha Chapman, Oregon Health Authority

Topics covered…  Displaying your data  PROC Print  PROC Sort  Global statements  Titles  Footnotes  System options

Topics covered…  Output Delivery System (ODS)  ODS PDF, ODS RTF, ODS HTML  Styles  ODS Escapechar  Excel XP Tagset  ODS Select/Exclude  ODS Output

Displaying your data

PROC Print  PROC Print can be used to list the data in a SAS dataset

Results of PROC Print of “Demographics” PROC Print

 Many options to control output of PROC Print  noobs – Suppresses “OBS” column in output  (obs=2) – Only prints the first two observations Can put in any number: 1 through N Must be placed in parentheses after data= option  var statement – Only prints listed variables

PROC Print  where statement – Only print selected observations  format statement – Apply format to selected variables  Only applies to current procedure  label statement – Assign column headers  Only applies for current procedure  Must use label option, even if label statement is present

PROC Sort We interrupt this message for…

PROC Sort

AZAZ

ZAZA

AZAZ ZAZA ZAZA ZAZA ZAZA

PROC Print Now back to…

PROC Print  id statement – Assigns an observation ID based on listed variable (instead of OBS number)  by statement – Produces a separate section of the report for each BY group  pageby statement – Creates a page break after each BY group (not shown)  Must use be used with BY statement

PROC Print

 sumby statement – Calculates a sum for each BY group and total sum  Must use be used with BY statement  sum statement – selects which variables to sum  If excluded, all numeric variables are summed

PROC Print

 Every PROC and DATA step with BY statement must use dataset sorted by BY variable  Use descending option if sorted in descending order

PROC Print  Every PROC and DATA step with BY statement must use dataset sorted by BY variable  Use notsorted option if prefer data be sorted by some other variable

PROC Print  PROC Print useful for providing quick list of data  SAS 9.3 includes new options for PROC Print  (see linked paper)  Other reporting procedures (PROC Report, PROC Tabulate) usually better for more complex reports  We’ll discuss these in later chapters

Titles, footnotes, options Global statements

Global statements: Remain in effect until changed by another global statement or SAS session ends Examples: Titles, Footnotes, Options, Macros, Libname Global statements: Remain in effect until changed by another global statement or SAS session ends Examples: Titles, Footnotes, Options, Macros, Libname

 Can have up to ten title lines and ten footnote lines  Titles and footnotes will appear on the top and bottom of every page Titles and footnotes

Blank line for unspecified Title2

 Titles and footnotes remain in effect until overwritten by another title/footnote or until SAS session ends  Submitting a new titleN statement will replace titleN, plus all title lines below it (same for footnotes)  Will not affect lines above it  To cancel all titles and/or footnotes: Titles and footnotes

System options  System options are instructions that affect your SAS session  System options remain in effect until changed by another option statement or until SAS session ends  Some options affecting appearance of output will be overridden by the Output Delivery System (ODS)  ODS will be discussed in later slides

Examples of system options SAS Documentation

Common system options OPTIONS option(s); OptionPurposeDefault date | nodate Specifies whether to print the system date/time on the output date number | nonumber Specifies whether to print the page number on the output number orientation= Specifies the paper orientation to use for the output portrait yearcutoff= Specifies the first year of the 100-year span for reading two-digit years 1920

Output Delivery System (ODS)

 ODS allows output from procedures to be presented in multiple formats  PDF  Excel  HTML  Word  Etc.

Output Delivery System (ODS)  Many advantages of ODS:  Output can be opened in non-SAS applications  More control over the appearance of the output  Can send output to multiple destinations at once

Output Delivery System (ODS)  ODS code is sandwiched around your output producing SAS code  Anything produced within the ODS sandwich is output to the selected destination

Output Delivery System (ODS) ODS Listing

Output Delivery System (ODS) ODS PDF

Output Delivery System (ODS) PROC Print ODS Listing (Output window)

Output Delivery System (ODS) ODS destination FILE=‘file-pathname.ext’; ODS destination CLOSE;  destination : Desired ODS destination (PDF, HTML, etc.)  file-pathname.ext : Pathway and filename for new output file with appropriate file extension  (Almost) every opened destination must be closed

ODS PDF ODS open statement Includes file pathway and filename with a.pdf extension

ODS PDF Procedures in the ODS sandwich PROC Print output will be included in the PDF file PROC Sort produces no output (Can include one or many DATA or PROC steps within the ODS sandwich)

ODS PDF ODS close statement File will not be created until ODS close statement

ODS PDF System options Some system options will not affect ODS output (depending on the destination)

ODS PDF Titles/Footnotes Can also be changed within the ODS sandwich

ODS PDF

ODS Styles Add a style option to give the report some “pizzazz”

ODS Styles

 Style templates can be used with (almost) any destination  Templates control the format and appearance of the report – font, colors, sizing, justification, etc.  Can use SAS supplied templates or create your own with PROC Template  To see the list of available style templates:

ODS Styles Can use style overrides within the SAS procedure to modify one small aspect of the style.

ODS Styles

ODS Escapechar  ODS Escapechar defines a character that can begin formatting commands  Allows formatting commands to be put in non-standard locations, such as titles, footnotes, row headers, etc.

ODS Escapechar Footnotes from an ODS PDF produced report Longer than traditional footnotes would allow

ODS Escapechar Custom line breaks Footnotes from an ODS PDF produced report

ODS Escapechar Changes in font style Footnotes from an ODS PDF produced report

ODS Escapechar Define the escapechar (can be anything you choose) Common choices are ~ or ^

ODS Escapechar Use escape sequences to embed style parameters: ~S={style overrides} or ~STYLE={style overrides}

ODS Escapechar Use ~n and ~2n to create line and double line breaks

ODS Escapechar Quick note: SAS Log may warn that the footnote may be too long, but it should print properly in PDF

Excel  Multiple ways to save SAS output to Excel  Use ODS HTML with a.xls extension  Use ExcelXP Tagset

ExcelXP Tagset  Excel XP Tagset creates XML files that can be read by Excel (version XP and later)  Can create multi-sheet workbooks

ODS Trace  Some procedures (particularly stat procedures) produce multiple pieces of output  ODS Trace will print the names of the output objects in the log

ODS Select/Exclude  Use ODS Select or ODS Exclude to only include certain objects in your output file  Use the “Name” from the ODS Trace output to name the objects to select or exclude

ODS Output  Many procedures have OUT= or OUTPUT statement options to send results to a SAS dataset  Can also use ODS OUTPUT to send your output results to a SAS dataset ODS OUTPUT = ;

ODS Output

ODS Reading List PaperSummary ODS: Output Delivery System Tip Sheet Quick tip sheet for common options to use with ODS SAS Styles ExamplesExamples of SAS style templates Reporting Procedure Styles Tip SheetQuick tip sheet for using style overrides in PROC steps PDF Can Be Pretty Darn FancyAdvanced tips and tricks for ODS PDF including using ODS EscapeChar and ODS Layout An Introduction to Creating Multi- Sheet Microsoft Excel Workbooks the Easy Way with SAS® (2012) Tips for using the ExcelXP tagset. This is only one of many similar papers written by Vince DelGobbo. ExcelXP Tagset Paper IndexAn index for all the tricks found in Vince’s many ExcelXP Tagset papers The Greatest Hits: ODS Essentials Every User Should Know More ODS tips and tricks including using ODS output, ODS Graphics, cascading style sheets, and more.

Read chapters 16 & 17 and section 10.6 For next week…