Reporting from Base SAS Tips & Tricks. Fareeza Khurshed BC Cancer Agency

Similar documents
Avoiding Macros in SAS. Fareeza Khurshed Yiye Zeng

Exporting Variable Labels as Column Headers in Excel using SAS Chaitanya Chowdagam, MaxisIT Inc., Metuchen, NJ

Fall 2012 OASUS Questions and Answers

Maintaining Formats when Exporting Data from SAS into Microsoft Excel

An Introduction to Creating Multi- Sheet Microsoft Excel Workbooks the Easy Way with SAS

Hooking up SAS and Excel. Colin Harris Technical Director

Moving Data and Results Between SAS and Excel. Harry Droogendyk Stratia Consulting Inc.

Multi-sheet Workbooks from SAS. data using the ODS ExcelXP tagset. Another Way to EXCEL using SAS

Applications Big & Small. Printable Spreadsheets Made Easy: Utilizing the SAS Excel XP Tagset Rick Andrews, UnitedHealth Group, Cary, NC

All Aboard! Next Stop is the Destination Excel

Making a SYLK file from SAS data. Another way to Excel using SAS

The REPORT Procedure and ODS Destination for Microsoft Excel: The Smarter, Faster Way to Create First-Rate Excel Reports

Creating Multi-Sheet Excel Workbooks the Easy Way with SAS Vincent DelGobbo, SAS Institute Inc., Cary, NC

Creating Stylish Multi-Sheet Microsoft Excel Workbooks the Easy Way with SAS Vincent DelGobbo, SAS Institute Inc., Cary, NC

WHERE YOUR MIND REALLY IS

Tips and Tricks for Creating Multi-Sheet Microsoft Excel Workbooks the Easy Way with SAS. Vincent DelGobbo, SAS Institute Inc.

Spring 2008 OASUS Q&A

Data Edit-checks Integration using ODS Tagset Niraj J. Pandya, Element Technologies Inc., NJ Vinodh Paida, Impressive Systems Inc.

New for SAS 9.4: A Technique for Including Text and Graphics in Your Microsoft Excel Workbooks, Part 1

New for SAS 9.4: Including Text and Graphics in Your Microsoft Excel Workbooks, Part 2

Quick Data Definitions Using SQL, REPORT and PRINT Procedures Bradford J. Danner, PharmaNet/i3, Tennessee

Professional outputs with ODS LATEX

Guide Users along Information Pathways and Surf through the Data

The Perfect Marriage: The SAS Output Delivery System (ODS) and

Better Metadata Through SAS II: %SYSFUNC, PROC DATASETS, and Dictionary Tables

ODS TAGSETS - a Powerful Reporting Method

Workbooks (File) and Worksheet Handling

Getting Started with the XML Engine

Manipulating Statistical and Other Procedure Output to Get the Results That You Need

NEW FEATURES IN FOUNDATION SAS 9.4 CYNTHIA JOHNSON CUSTOMER LOYALTY

Tips for Moving From Base SAS 9.3 to SAS Enterprise Guide 5.1 Anjan Matlapudi Corporate Medical Informatics AmeriHealth Caritas Family of Companies

Creating AND Importing Multi-Sheet Excel Workbooks the Easy Way with SAS

Exploring Microsoft Office Excel 2007

%check_codelist: A SAS macro to check SDTM domains against controlled terminology

Unleash the Power of PROC REPORT with the ODS EXCEL Destination

The REPORT Procedure: A Primer for the Compute Block

Essentials of the SAS Output Delivery System (ODS)

Traffic Lighting Your Multi-Sheet Microsoft Excel Workbooks the Easy Way with SAS Vincent DelGobbo, SAS Institute Inc., Cary, NC

Paper RV-011 Using the Excel XP tagset and DDE to create At-A-Glance Summary Spreadsheets Compiled, Written, and Formatted with one SAS click!

SAS (Statistical Analysis Software/System)

Introduction to SAS Procedures SAS Basics III. Susan J. Slaughter, Avocet Solutions

PROC REPORT AN INTRODUCTION

ECLT 5810 SAS Programming - Introduction

TIPS AND TRICKS: IMPROVE EFFICIENCY TO YOUR SAS PROGRAMMING

Square Peg, Square Hole Getting Tables to Fit on Slides in the ODS Destination for PowerPoint

ABSTRACT INTRODUCTION MACRO. Paper RF

INTRODUCTION TO SAS HOW SAS WORKS READING RAW DATA INTO SAS

Don t Forget About SMALL Data

Introduction to SAS Procedures SAS Basics III. Susan J. Slaughter, Avocet Solutions

Create Metadata Documentation using ExcelXP

Quality Control of Clinical Data Listings with Proc Compare

New Perspectives on Microsoft Excel Module 5: Working with Excel Tables, PivotTables, and PivotCharts

Lastly, in case you don t already know this, and don t have Excel on your computers, you can get it for free through IT s website under software.

OASUS Spring 2014 Questions and Answers

Stat 302 Statistical Software and Its Applications SAS: Data I/O

Introduction to SAS. Cristina Murray-Krezan Research Assistant Professor of Internal Medicine Biostatistician, CTSC

Tutorial 5: Working with Excel Tables, PivotTables, and PivotCharts. Microsoft Excel 2013 Enhanced

SAS Web Report Studio 3.1

Let SAS Play a Pivotal Role in Your Life

Excel for Dummies: Quick Reference

More Tips and Tricks for Creating Multi-Sheet Microsoft Excel Workbooks the Easy Way with SAS Vincent DelGobbo, SAS Institute Inc, Cary, NC

SAS (Statistical Analysis Software/System)

Paper S Data Presentation 101: An Analyst s Perspective

Multiple Graphical and Tabular Reports on One Page, Multiple Ways to Do It Niraj J Pandya, CT, USA

ABSTRACT. Paper

- 1 - ABSTRACT. Paper TU02

Applications Development

Uncommon Techniques for Common Variables

Increasing Student Progress Monitoring via PROC REPORT and ExcelXP Tagset

Windows Application Using.NET and SAS to Produce Custom Rater Reliability Reports Sailesh Vezzu, Educational Testing Service, Princeton, NJ

Prove QC Quality Create SAS Datasets from RTF Files Honghua Chen, OCKHAM, Cary, NC

York Public Schools Subject Area: Technology Grade: 9-12 Course: Information Technology 2 NUMBER OF DAYS ASSESSED TAUGHT DATE

ExcelXP on Steroids: Adding Custom Options To The ExcelXP Tagset Mike Molter, D-Wise, Raleigh, NC

Table of Contents. The RETAIN Statement. The LAG and DIF Functions. FIRST. and LAST. Temporary Variables. List of Programs.

SAS Online Training: Course contents: Agenda:

Getting Up to Speed with PROC REPORT Kimberly LeBouton, K.J.L. Computing, Rossmoor, CA

PDF Accessibility: How SAS 9.4M5 Enables Automatic Production of Accessible PDF Files

Beginning Tutorials. bt006 USING ODS. Ban Chuan Cheah, Westat, Rockville, MD. Abstract

A SAS Format Catalog for ICD-9/ICD-10 Diagnoses and Procedures: Data Research Example and Custom Reporting Example

Purchase this book at

Introduction to the SAS System

Real Time Clinical Trial Oversight with SAS

Paper DB2 table. For a simple read of a table, SQL and DATA step operate with similar efficiency.

Unleash the Power of PROC REPORT With the ODS EXCEL Destination

Essential ODS Techniques for Creating Reports in PDF Patrick Thornton, SRI International, Menlo Park, CA

For comprehensive certification training, students should complete Excel 2007: Basic, Intermediate, and Advanced. Course Introduction

A Quick and Gentle Introduction to PROC SQL

ET01. LIBNAME libref <engine-name> <physical-file-name> <libname-options>; <SAS Code> LIBNAME libref CLEAR;

Same Data Different Attributes: Cloning Issues with Data Sets Brian Varney, Experis Business Analytics, Portage, MI

Microsoft Office Excel 2010: Intermediate. Course Overview. Course Length: 1 Day. Course Overview

Overview 14 Table Definitions and Style Definitions 16 Output Objects and Output Destinations 18 ODS References and Resources 20

Contents About SAS Enterprise Guide About This Book xi Acknowledgments xiii

SAS is the most widely installed analytical tool on mainframes. I don t know the situation for midrange and PCs. My Focus for SAS Tools Here

A Table Driven ODS Macro Diane E. Brown, exponential Systems, Indianapolis, IN

Export a PROTECT Report to Excel (User s Guide Lesson 21 : Reports) Tips for Using Microsoft Excel and Exported Reports

Edwin Ponraj Thangarajan, PRA Health Sciences, Chennai, India Giri Balasubramanian, PRA Health Sciences, Chennai, India

Attending delegates will be presented with a Certificate of Attendance upon completion of training.

Using Templates Created by the SAS/STAT Procedures

A SAS Macro for Producing Benchmarks for Interpreting School Effect Sizes

Choosing the Right Tool from Your SAS and Microsoft Excel Tool Belt

Transcription:

Reporting from Base SAS Tips & Tricks Fareeza Khurshed BC Cancer Agency

Overview Index for large data Summarizing Data Getting Data to Excel

Index Think of book index or library catalogue or search function

Index

Index Example with sashelp.zipcode file 41761 Zipcodes (version dependent) 58 States 58/41761 = 0.14% libname zip 'C:\temp'; data zip.zipcode; set sashelp.zipcode; *Copy file; run;

Index Can be created using Proc SQL, Proc Datasets, or a Data step Proc Datasets example PROC DATASETS library=zip;*library name; Run;quit; MODIFY zipcode; *Dataset name; Index create state_code;*single field;

Create Index

Check for Index Proc contents data=zip.zipcode; Run;

When to Index Specific field(s) that data can be filtered on Field will be filtered on using a WHERE, BY or KEY clause Reference file should be less than 20% of file Data set required for analysis is large Permission to modify data

Using an Index SAS Does It! Should be used in WHERE, BY or KEY Option msglevel=i;

Index Example Dataset is all surgeries performed in BC from 3GB, 1.8 million rows, 102 variables Wait time for surgery Cohort analysis based on when surgery booked

Index Example Analysis is done on Health Authority, Health Service Delivery Area and Hospitals by Date Which to use as index? Main filter for report Reduces data into smallest subset Date best choice

Index Example *Sort Dataset; proc sort data=spr.spr_report_data_detailed; by booking_form_received_date; run; *Create an index on the booking_form_received_date; proc datasets library=spr NODETAILS NOLIST; modify spr_report_data_detailed; index create booking_form_received_date; run;quit; *Query Dataset; data spr_select_dates; set spr.spr_report_data_detailed; where booking_form_received_date between "&start_date."d and "&end_date."d; run ; 8:57 minutes 3 reports ~27 minutes

Index Example *Sort Dataset; proc sort data=spr.spr_report_data_detailed; by booking_form_received_date; run; *Create an index on the booking_form_received_date; proc datasets library=spr NODETAILS NOLIST; modify spr_report_data_detailed; index create booking_form_received_date; run;quit; *Query Dataset; data spr_select_dates; set spr.spr_report_data_detailed; where booking_form_received_date between "&start_date."d and "&end_date."d; run ; 25:00 minutes 15:00 minutes 10:00 minutes 3 reports ~ 45 minutes

Index Example *Sort Dataset; proc sort data=spr.spr_report_data_detailed; by booking_form_received_date; run; *Create an index on the booking_form_received_date; proc datasets library=spr NODETAILS NOLIST; modify spr_report_data_detailed; index create booking_form_received_date; run;quit; *Query Dataset; data spr_select_dates; set spr.spr_report_data_detailed; 9:00 minutes 3:30 minutes where booking_form_received_date between "&start_date."d and "&end_date."d; run ; 12:30 minutes 3 reports ~19:30 minutes

Index Example *Sort Dataset; proc sort data=spr.spr_report_data_detailed; by booking_form_received_date; run; 10:00 minutes *Create an index on the booking_form_received_date; proc datasets library=spr NODETAILS NOLIST; modify spr_report_data_detailed; index create booking_form_received_date; run;quit; 7 seconds *Query Dataset; data spr_select_dates; set spr.spr_report_data_detailed; where booking_form_received_date between "&start_date."d and "&end_date."d; run ; 19:07 minutes 9:00 minutes 3 reports ~19:21 minutes

Index Simple Index single field Multiple Single Indices Composite Index multiple field

Index - References Paper 123-29 Creating and Exploiting SAS Indexes Michael A. Raithel, Westat, Rockville, MD

Summarizing Data Summary stats such as N/Mean/Median Summary at different levels Subtotals Summary by different categories

Summarizing data Proc means Use class statement Can control interactions Can use WAYS and TYPE statements to control output levels

Proc Means title 'Example of Ways Statement' ; proc means data=sashelp.class n mean median maxdec=2; class sex age; WAYS 0 1 2 ; var height; run; WAYS controls the interaction levels 0 Overall Total 1 Individual Total for each class level 2 Two Way Interaction between each class level

Proc Means

Proc Means title 'Example of Type Statement' ; proc means data=sashelp.cars ; class make type cylinders; types make * (type cylinders); var mpg_city; run;

Proc Means Output to dataset title 'Example of Type Statement' ; ods table summary=ex_type1; proc means data=sashelp.cars ; where make in ('Acura', 'BMW', 'Hyundai'); class make type cylinders; types make * (type cylinders); var mpg_city; output out=ex_type2; run;

Proc Means - Output ex_type1 ex_type2

References Proc Means SAS Documentation

ODS Tagsets ExcelXP Generates XML readable by Excel Requires template code download from support.sas.com Available here Run it once and good to go (until you need an update)

ODS tagsets.excelxp Some useful features: Formatting of rows, columns or cells using proc report Automatic insertion of filters to let user filter the result Control which tabs results are placed on

Tagsets.ExcelXP ods tagsets.excelxp file= C:\temp\sashelp_class.xls" style=journal options( fittopage='yes' orientation='landscape' scale='150' sheet_interval='proc' autofilter='1-3' sheet_name='class Summary'); SAS CODE GOES HERE; ods tagsets.excelxp close;

Tagsets.ExcelXP proc report data=sashelp.class nowd split='*'; column (name) ('Demographics' sex age height weight); define name/center 'Name'; define sex/ center 'Sex'; define age/center 'Age*(yrs)'; define height/center 'Height*(in)'; define weight/center 'Weight*(lbs)'; compute name; if find(name,'l')>0 then call define(_row_, 'style', 'style=[background=grey]'); endcomp; run;quit;

Tagsets.ExcelXP

Tagsets.ExcelXP Add in Titles/Remove styles ods tagsets.excelxp file="c:\temp\sashelp_class.xls" options( embedded_titles='yes' fittopage='yes' orientation='landscape' scale='150' sheet_interval='none' sheet_name='summary'); title 'Frequency of Age and Sex'; proc freq data=sashelp.class; tables age sex; run; title 'Summary Stats of Weight and Height'; proc means data=sashelp.class maxdec=2; var weight height; run; ods tagsets.excelxp close;

Tagsets.ExcelXP

Tagsets.ExcelXP MultiSheet Example ods tagsets.excelxp file="c:\temp\sashelp_class.xls" options( embedded_titles='yes' fittopage='yes' orientation='landscape' scale='150' sheet_interval='by' sheet_label=''); title 'Example of Multiple Sheets'; proc sort data=sashelp.class out=class; by sex; run; proc print data=class noobs label; by sex; run; ods tagsets.excelxp close;

Tagsets.ExcelXP

References http://support.sas.com/rnd/base/ods/odsmarkup/excelxp_help.html http://support.sas.com/rnd/base/ods/odsmarkup/excelxp_demo.html Paper 170-2011 Creating Stylish Multi-Sheet Microsoft Excel Workbooks the Easy Way with SAS Vince DelGobbo, SAS Institute Inc. Cary, NC

Conclusion Speed up queries with an index Use Types and Ways to summarize data with one step Exporting to Excel with Tagsets.ExcelXP

Acknowledgements Thanks for the support of the BC Cancer Agency Thanks for the support of the Biostatisticians within Cancer Surveillance & Outcomes

Questions

Contact Info fkhurshed@bccancer.bc.ca Fareeza Khurshed, MSc. Biostatistician Cancer Surveillance & Outcomes Population Oncology BC Cancer Agency 801-686 West Broadway Vancouver, BC V5Z 1G1