Use SAS to Automate Hospital Reports generation Cardiac Service BC Stats Team, PHSA Tina Yang.

Slides:



Advertisements
Similar presentations
Little Used, but Powerful Features with GP Cathy Fregelette, CPA, PMP Practice Manager BroadPoint Technologies September 20, 2012.
Advertisements

© Paradigm Publishing, Inc Excel 2013 Level 2 Unit 2Managing and Integrating Data and the Excel Environment Chapter 7Automating Repetitive Tasks.
Computer Science & Engineering 2111 Text Functions 1CSE 2111 Lecture-Text Functions.
Office 2003 Post-Advanced Concepts and Techniques M i c r o s o f t Excel Project 7 Using Macros and Visual Basic for Applications (VBA) with Excel.
Using Macros and Visual Basic for Applications (VBA) with Excel
Developing an Excel Application
Tutorial 8: Developing an Excel Application
5/1/ Quick and Dirty Excel® Workbooks Without DDE or ODS Andrea Zimmerman, Capital One, Richmond, VA.
Worst, but still importable data I’ve ever seen Arthur Tabachneck Insurance Bureau of Canada.
Tutorial 12: Enhancing Excel with Visual Basic for Applications
ACTIVITY-6 WORKING WITH SPREADSHEET SOFTWARE TO PREPARE/FORMAT DIFFERENT KINDS OF SHEETS/TABLES BRIDGE COURSE of INFORMATION & COMMUNICATION TECHNOLOGY.
Working Smarter, Not Harder with DDE: Did I Really Spend All That Time Just Formatting My Report? Bobby Kidd Vice President Senior Statistical Portfolio.
1 Chapter 12 Working With Access 2000 on the Internet.
Macros Excel built-in functions are great but limited Macros are a means for the user to define new functions A macro is a single command that automates.
Lecture Excel: Multiple Worksheets. Workbook and Worksheets Multiple worksheets in a single workbook. When saved, only a single workbook (XLS) is saved.
Macros Tutorial Week 20. Objectives By the end of this tutorial you should understand how to: Create macros Assign macros to events Associate macros with.
Adding Automated Functionality to Office Applications.
Macros in Excel Intro to lab 1. Macroinstructions Macro is recorded in VBA module sequence of Excel operations Macros can automate tasks in Excel Macro.
COMPREHENSIVE Excel Tutorial 8 Developing an Excel Application.
Exploring Microsoft Excel 2002 Chapter 8 Chapter 8 Automating Repetitive Tasks: Macros and Visual Basic for Applications By Robert T. Grauer Maryann Barber.
Computer Science & Engineering 2111 Data Validation and Macros 1 CSE 2111 Lecture-Data Validation and Macros.
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
OFC304 Excel 2003 Overview: XML Support Joseph Chirilov Program Manager.
Microsoft Excel 2007 © Wiley Publishing All Rights Reserved. The L Line The Express Line to Learning L Line.
Spreadsheet-Based Decision Support Systems Chapter 22:
Copyright 2007, Paradigm Publishing Inc. EXCEL 2007 Chapter 7 BACKNEXTEND 7-1 LINKS TO OBJECTIVES Record & run a macro Record & run a macro Save as a macro-
Microsoft Excel Macros & Excel Solver (IENG490)
First Screen : First window form will always remain open, for the user to select menu options. 1.
Microsoft Excel 2003 Illustrated Complete
An Animated Guide©: Sending SAS files to Excel Concentrating on a D.D.E. Macro.
Lecture Excel: Macros & Pivot Tables. Macros A macro is a series of commands that are stored and can be run whenever you need to perform the task.
Jack Working with Excel - Usage of Dynamic Data Exchange in PMS studies.
To enhance learning, service, and research through an advanced information technology environment. Our Mission:To enhance learning, service,and research.
Microsoft Access 2010 Building and Using Queries.
1 Performing Spreadsheet What-If Analysis Applications of Spreadsheets.
McGraw-Hill/Irwin The Interactive Computing Series © 2002 The McGraw-Hill Companies, Inc. All rights reserved. Microsoft Excel 2002 Lesson 1 Introduction.
Computer Science & Engineering 2111 Lecture 9 Data Validation, Worksheet Protection, and Macros 1CSE Data Validation and Macros.
Just as there are many human languages, there are many computer programming languages that can be used to develop software. Some are named after people,
Visual Basic for Applications Macro Programming For Microsoft Office.
VBA Lab 2 I ns.Samia Al-blwi. Visual Basic Grammar Object: Visual Basic is an object-oriented language. This means that all the items in Excel are thought.
TPM Software within Good Spirit School Division. TPM Software is an integrated Student Services Software Solution Forms / Printouts / Reports Integrated.
Chapter 17 Creating a Database.
Just how do you get invoices loaded into Payables using Microsoft Excel? NZOUG Conference 2008.
SESSION 3.1 This section covers using the query window in design view to create a query and sorting & filtering data while in a datasheet view. Microsoft.
Microsoft Access 2010 Chapter 8 Advanced Form Techniques.
Microsoft ® Office Excel 2003 Training Using XML in Excel SynAppSys Educational Services presents:
Chapter 9 Macros And Visual Basic For Applications.
1 EndNote X2 Your Bibliographic Management Tool 29 September 2009 Humanities and Social Sciences Resource Teams.
1 Lesson 13 Organizing and Enhancing Worksheets Computer Literacy BASICS: A Comprehensive Guide to IC 3, 3 rd Edition Morrison / Wells.
Introduction to Microsoft Excel Macros COE 201- Computer Proficiency.
CIAF Summary Report 2012/13 TPM Software within Good Spirit School Division.
21 Copyright © 2009, Oracle. All rights reserved. Working with Oracle Business Intelligence Answers.
Based on Learning SAS by Example: A Programmer’s Guide Chapters 1 & 2
Chapter 10 Using Macros, Controls and Visual Basic for Applications (VBA) with Excel Microsoft Excel 2013.
SAS ® 101 Based on Learning SAS by Example: A Programmer’s Guide Chapters 14 & 19 By Tasha Chapman, Oregon Health Authority.
McGraw-Hill/Irwin The Interactive Computing Series © 2002 The McGraw-Hill Companies, Inc. All rights reserved. Microsoft Excel 2002 Using Macros Lesson.
COMPREHENSIVE Excel Tutorial 12 Expanding Excel with Visual Basic for Applications.
Build your Metadata with PROC CONTENTS and ODS OUTPUT Louise S. Hadden Abt Associates Inc.
Forum to improve your experience entering data into SRDR 1 SRDR is being developed and maintained by the Brown EPC under contract with the Agency for Healthcare.
Software Development Languages and Environments. Computer Languages Just as there are many human languages, there are many computer programming languages.
Section 3 Computing with confidence. The purpose of this section The purpose of this section is to develop your skills to achieve two goals: 1-Becoming.
Using SAS to Create Multi-Sheet Excel Workbooks
Excel Tutorial 8 Developing an Excel Application
Excel: Macros & Pivot Tables
Data Validation and Protecting Workbook
Microsoft Excel 2003 Illustrated Complete
Learning Excel Session 9 and 10 Dr. Chaitali Basu Mukherji.
Exploring Microsoft Excel
Microsoft Excel 2007 – Level 2
Presentation transcript:

Use SAS to Automate Hospital Reports generation Cardiac Service BC Stats Team, PHSA Tina Yang

Hospital Reports Overview O A cross province quality assurance report focusing on clinical and performance indicators O 2 major reports for each of the 5 BC hospitals: Cathlab and Surgery O Surgery report as today’s example

Hospital Reports Challenges O Data Preview: O Large amount of information need to be disseminated O Each hospital has the same variables and metrics O Audience maybe senior management, data-entry clerks, who don’t know the story behind the data well O 5 hospitals, i.e. ~ 5 packages with distinct numbers, but in the same format, need to be created accurately and efficiently for each report

Excel Template for Surgery reports FMM Isolated CABG Waitlist Activities by Hospital (Time frame) Hospital Outpatient WaitlistInpatient WaitlistInpatient and Outpatient Waitlist Complete d Unbooked Cases Total Complete d Cases** Start Add Complete* Remove End Start Add Complete* Remove End Start Add Complete* Remove End Hosp 1 Hosp 2 Hosp 3 Hosp 4 Hosp 5 BC Example 1: Example 2: Open Heart Surgery Wait List from Hosp 1 (Time frame) Wait Time(Days) Surgeon Start Waitlist Numb er Added Completed from Waitlist Removed from Waitlist End Waitlist Median p90 Max Completed Unbooked/In- hospital Booking Cases Total Completed Cases Doctor 1 Doctor 2 Hosp 1 total

Possible Report Generation Methods O Excel VBA macro O Create an Excel workbook template for each sheet O Export prepared data from SAS into Excel O Call the VBA macro to populate the Excel template, one hospital/workbook at a time O Save the populated template with a distinct name for that corresponding hospital

Possible Report Generation Methods O Excel VBA macro O Pros O The reports will be automated in hospital-level O Can generate a set of Excel templates O Cons O Need to export data from SAS into Excel, which is not an analytical environment

Possible Report Generation Methods O Excelxp in SAS O Prepare data in SAS O Use proc tabulate and proc export to export data into Excel and format the output data tables O An output example using proc tabulate(from other project)

Possible Report Generation Methods O Excelxp in SAS O Pros O Amazing number of options and flexibility O Both of the data preparation and formatting processes could be finished in SAS O Cons O Date variables exported from SAS will be interpreted as a text variable O Why don’t we use ExcelXP? O We would like to have a set of Excel templates not only for this report, but for other requests. O Ideal: have SAS to do part of what VBA macro does

SAS DDE O What is DDE? O Inter-process communication between programs O Use one programming language to control/communicate with another O SAS DDE O Can export SAS data to Excel, Word O Two approaches O Execute all code directly in SAS O Create a pre-formed Excel template and populate it using SAS DDE (We use this one!)

DDE: Key steps O Write values in the specific row and column O To write ‘Overall’ in row 4 column 3-7 filename excel dde "excel| &excelin.!r4c3:r4c7" notab; data _null_; file excel; put "Overall"; run ; O Use existed macro to format cells: O To make the title in bold O In SAS data _null_; file cmdexcel; put '[select("R1C1:R1C' "&columns" '")]'; put '[RUN("PERSONAL.XLS!Macro4",FALSE)]'; O Macro4 in Excel Sub Macro4() Selection.Font.Bold = True End Sub

DDE: Key steps O Important system options options noxsync noxwait; noxwait: specifies that the command processor automatically returns to the SAS session after the specified command is executed noxsync: instructs SAS to continue processing as soon as the operating system command is issued O Open Excel O There are different ways of opening Excel by DDE O In this project, since we need to generate multiple workbooks, a SAS macro was used to open Excel. O Detail of the macro: Using Dynamic Data Exchange (DDE) and Macro Variables to Create Custom Excel Workbooks with Multi-Sheets O

DDE: Key steps O Save file filename cmds dde 'excel|system'; data _null_; file cmds; put '[SAVE.AS(“file directory")]'; put '[close]'; run; O More information on DDE: O SAS Professional Forum on LinkedIn O SAS Health User Group on LinkedIn

DDE: Demo O Object: O Generate a demographic summary report of the students in 3 different grades O Mean O Std Dev O Data: Data demo; Input grade ht wt; Cards; … ;

DDE: Demo O Step: O 1. Create a template in Excel I saved this spreadsheet as demo.xlsx and named the template sheet summary O 2. Calculate mean and standard deviation in SAS proc sort data = demo; by grade; run; proc summary data=demo; var ht; class grade; output out=demo_summary; run;

DDE: Demo O Step: O 3. Call Excel template in SAS options noxwait noxsync; x '“file_directory\demo.xlsx"'; filename example1 dde 'excel|summary!r2c3:r4c3'; O 4. Write SAS output into Excel template data demo_summary; set demo_summary; file example1; if _stat_ = "MEAN" then put ht; run;

DDE: Demo O Step: O 5. Continue to write stand deviations to template filename example1 dde 'excel|summary!r5c3:r7c3'; data demo_summary; set demo_summary; file example1; if _stat_ = "STD" then put ht; run;

DDE: Demo O Step: O Save O Option1: close the opened excel file and click ‘Save’ when Microsoft asks you, and the file will be saved under the same directory as the template O Option2: Use SAS to close and save the file filename example1 dde 'excel|system'; data _null_; file example1; put '[SAVE.AS(“file_directory\file_name.xls")]'; put '[close]'; run;

DDE: Demo O Another options: O Use Excel VBA macro O Record the creation of the template as a macro and save it in Excel O The recorded macro for creating the template Sub tina_temp() Range("B1").Select ActiveCell.FormulaR1C1 = "Data Summary“ **Write ‘Data Summary’ to cell B1** Range("A2").Select ActiveCell.FormulaR1C1 = "Means“ **Write ‘Means’ A2** …. End Sub

DDE: Demo O Another option: O Use Excel VBA macro O Open a workbook in Excel options noxsync noxwait xmin; filename sas2xl dde 'excel|system'; data _null_; length fid rc start stop time 8; fid=fopen('sas2xl','s'); if (fid le 0) then do; rc=system('start excel'); start=datetime(); stop=start+10; do while (fid le 0); fid=fopen('sas2xl','s'); time=datetime(); if (time ge stop) then fid=1; end; rc=fclose(fid); run; O An Excel Window will open

DDE: Demo O Another option: O Use Excel VBA macro O Call the Excel macro template in SAS filename cmdexcel dde 'excel|system'; data _null_; file cmdexcel; put '[RUN("PERSONAL.XLS!tina_temp",FALSE)]'; run; O You will see the pop-up Excel be formatted like this:

DDE: Dem0 O Another option: O Use Excel VBA macro O Write output into Excel filename cmdexcel dde 'excel|Sheet1!r2c3:r4c3'; data demo_summary; set demo_summary; file cmdexcel; if _stat_ = "MEAN" then put ht; run; ** write mean values in** O After this step:

DDE: Demo O Another option: O Use Excel VBA macro O Why use Excel VBA? O VBA macros can be permanently stored in Excel. Therefore, they can be re-used for different purposes O User can create/record VBA macros, therefore, it’s a more flexible option.

Questions???

Reference O ult/viewer.htm#win-sysop-xwait.htm O hC_ImportingExcelFiles.pdf O O