Integrating SAS and Microsoft Office for Analysis and Reporting of Hearing Loss in Occupational Health Management



Similar documents
Different Approaches to Maintaining Excel Reports

THE HELLO WORLD PROJECT

Importing Excel File using Microsoft Access in SAS Ajay Gupta, PPD Inc, Morrisville, NC

Migrating helpdesk to a new server

From Database to your Desktop: How to almost completely automate reports in SAS, with the power of Proc SQL

Create an Excel report using SAS : A comparison of the different techniques

Using Delphi Data with Excel and Access

Producing Listings and Reports Using SAS and Crystal Reports Krishna (Balakrishna) Dandamudi, PharmaNet - SPS, Kennett Square, PA

Importing Excel Files Into SAS Using DDE Curtis A. Smith, Defense Contract Audit Agency, La Mirada, CA

SUMMARY Moderate-High: Requires Visual Basic For Applications (VBA) skills, network file services skills and interoperability skills.

CHAPTER 23: USING ODBC

Choosing the Best Method to Create an Excel Report Romain Miralles, Clinovo, Sunnyvale, CA

Accessing Your Database with JMP 10 JMP Discovery Conference 2012 Brian Corcoran SAS Institute

Combining SAS LIBNAME and VBA Macro to Import Excel file in an Intriguing, Efficient way Ajay Gupta, PPD Inc, Morrisville, NC

Using SAS DDE to Control Excel

Inmagic ODBC Driver 8.00 Installation and Upgrade Notes

Interfacing SAS Software, Excel, and the Intranet without SAS/Intrnet TM Software or SAS Software for the Personal Computer

Data Presentation. Paper Using SAS Macros to Create Automated Excel Reports Containing Tables, Charts and Graphs

Linking Access to SQL Server

Business Intelligence Getting Started Guide

Creating Dynamic Reports Using Data Exchange to Excel

Using Microsoft Excel for Data Presentation Peter Godard and Cyndi Williamson, SRI International, Menlo Park, CA

Converting InfoPlus.21 Data to a Microsoft SQL Server 2000 Database

Business Intelligence Tutorial

Introduction. Why Use ODBC? Setting Up an ODBC Data Source. Stat/Math - Getting Started Using ODBC with SAS and SPSS

Getting Started Guide SAGE ACCPAC INTELLIGENCE

SEER Enterprise Shared Database Administrator s Guide

MICROSTRATEGY 9.3 Supplement Files Setup Transaction Services for Dashboard and App Developers

ABSTRACT INTRODUCTION SAS AND EXCEL CAPABILITIES SAS AND EXCEL STRUCTURES

Using DDE and SAS/Macro for Automated Excel Report Consolidation and Generation

Abstract. For notes detailing the changes in each release, see the MySQL for Excel Release Notes. For legal information, see the Legal Notices.

XMailer Reference Guide

Tips and Tricks SAGE ACCPAC INTELLIGENCE

SAS and Microsoft Excel for Tracking and Managing Clinical Trial Data: Methods and Applications for Information Delivery

Access to Relational Databases Using SAS. Frederick Pratter, Destiny Corp.

MAS 500 Intelligence Tips and Tricks Booklet Vol. 1

edwalt's - Things I Wish I'd known about Small Business Server...

Getting Started Guide

Grow Revenues and Reduce Risk with Powerful Analytics Software

Connect to a SQL Database with Monitouch

Technical Paper. Defining an ODBC Library in SAS 9.2 Management Console Using Microsoft Windows NT Authentication

Setting Up ALERE with Client/Server Data

ODBC (Open Database Communication) between the ElevateDB Database and Excel

A Comparison of SAS versus Microsoft Excel and Access s Inbuilt VBA Functionality Jozef Tarrant, Amadeus Software Ltd., Oxford, UK

Search help. More on Office.com: images templates

Sage 300 ERP Intelligence Reporting Getting Started Guide. Debra Holder March 2014

LINKING P3 DATABASE WITH ACCESS DATABASE OR EXCEL BY PAUL E HARRIS EASTWOOD HARRIS

SAS og Excel. Kender du fem forskellige måder at overføre data mellem SAS og Excel? Gert Nissen, seniorkonsulent

Create a New Database in Access 2010

How to Connect to CDL SQL Server Database via Internet

Siemens Applied Automation Page 1 11/26/03 9:57 PM. Maxum ODBC 3.11

Business Intelligence Tutorial: Introduction to the Data Warehouse Center

Hearing Protection Standard OSHA Standard 29 CFR

Getting Started with STATISTICA Enterprise Programming

BRIO QUERY FUNCTIONALITY IN COMPARISION TO CRYSTAL REPORTS

Citrix Systems, Inc.

Pastel Evolution BIC. Getting Started Guide

Table of Contents. Introduction. Audience. At Course Completion. Prerequisites

BulkSMS Text Messenger Product Manual

Microsoft Business Contact Manager Version 2.0 New to Product. Module 4: Importing and Exporting Data

9.1 SAS/ACCESS. Interface to SAP BW. User s Guide

vcenter Configuration Manager Backup and Disaster Recovery Guide VCM 5.3

QAD Enterprise Applications. Training Guide Demand Management 6.1 Technical Training

Streamlining Reports: A Look into Ad Hoc and Standardized Processes James Jenson, US Bancorp, Saint Paul, MN

How to Restore a Backup to Director V4.7x or greater

Using GABRIEL Excel to XML Templates

SAS, Excel, and the Intranet

Using the Query Analyzer

HELP DESK MANUAL INSTALLATION GUIDE

A Microsoft Access Based System, Using SAS as a Background Number Cruncher David Kiasi, Applications Alternatives, Upper Marlboro, MD

User Guide. Analytics Desktop Document Number:

Microsoft Access Glossary of Terms

Creating Dashboards for Microsoft Project Server 2010

An Overview of REDCap, a secure web-based application for Electronic Data Capture

How To Create A Report In Excel

Using SAS Enterprise Business Intelligence to Automate a Manual Process: A Case Study Erik S. Larsen, Independent Consultant, Charleston, SC

Simply Accounting Intelligence Tips and Tricks Booklet Vol. 1

MGC WebCommander Web Server Manager

CDW DATA QUALITY INITIATIVE

Spatial Database Support

Jet Data Manager 2012 User Guide

Installing Crystal Reports Runtime For use with the Human Resource Suite when using Progress version 9

TROUBLESHOOTING GUIDE

EASRestoreService. Manual

SQL Server An Overview

Short Manual Intellect v SP2 module Unipos Contents:

National Fire Incident Reporting System (NFIRS 5.0) NFIRS Data Entry/Validation Tool Users Guide

Almyta Control System Advanced Reference Contents

Indiana University Business Intelligence Getting Started: PowerPivot bi.iu.edu

Customized Excel Output Using the Excel Libname Harry Droogendyk, Stratia Consulting Inc., Lynden, ON

VBA Microsoft Access 2007 Macros to Import Formats and Labels to SAS

Datacolor TOOLS Technical Reference Guide

ODBC Driver Version 4 Manual

Improving Your Relationship with SAS Enterprise Guide

USQL Multi-Tier Client DSN s on Windows x64 editions

A Comparison of SAS versus Microsoft Excel and Access s Inbuilt VBA Functionality

Release Document Version: User Guide: SAP BusinessObjects Analysis, edition for Microsoft Office

Automate Your BI Administration to Save Millions with Command Manager and System Manager

A Guide To. File Butler. By Denver Tax Software, Inc.

SAS 9.4 PC Files Server

Transcription:

Integrating SAS and Microsoft Office for Analysis and Reporting of Hearing Loss in Occupational Health Management George Bukhbinder, Palisades Research, Inc., Bernardsville, NJ Mark Nicolich, ExxonMobil Biomedical Sciences, Inc., Annandale, NJ Abstract Evaluating the effectiveness of hearing conservation programs is an important part of occupational health management (OHM). Palisades Research, Inc. recently developed a data management and reporting system that provides access to historical audiometric data, performs analysis and creates a number of important audiometric measures. The system's analytical engine, which is written in SAS code, downloads data from a Microsoft SQL Server operational OHM database, performs data manipulation and calculations, and creates Excel reports and pivot tables on the company's shared drive. This system was implemented at ExxonMobil Corporation. It performs analysis of audiometric data and produces hearing loss statistics required for reporting to OSHA. Introduction Noise-induced hearing loss is one of the most common problems for industry worldwide. In the United States, occupational hearing loss is among the 10 leading occupational diseases. Many companies implement expensive hearing conservation programs aimed at reducing hearing loss in noise-exposed worker populations. Evaluating the effectiveness of these programs is essential in realizing this goal. Another important business function requiring extensive quantitative analysis of audiometric data is reporting hearing loss statistics to the Occupational Safety and Health Administration (OSHA). Audiometric data consists of hearing threshold measurements in either ear made at different frequencies. Tests are usually conducted annually. The historical audiometric information is combined with an employee's work history and demographic variables kept in an OHM database. The large volume and complex structure of the historical audiometric data require development of specialized analytical techniques designed for conducting audiometric analysis and producing standard reports. The implementation of this database approach usually requires gathering data residing at different transactional databases, developing an analytical engine capable of performing sophisticated time series analysis, and delivering final results in a user-friendly format over the Internet or corporate LAN. SAS is very well equipped to perform these tasks. It provides powerful analytical tools, the ability to access various database management systems on different platforms, and universal data delivery capabilities. That is why SAS was chosen for the development of the system for analysis and reporting of hearing loss at ExxonMobil Corporation. System Architecture Figure 1 describes the architecture. The OHM data warehouse consisting of both raw and processed data resides in a Microsoft SQL Server database. The SAS System and SAS programs performing the audiometric calculations ("audiometric calculations programs") reside on an NT server on which SAS Access To ODBC has been installed. This SAS product allows the NT server to access the SQL Server data using the code in Figure 2. The "DSN" in line 2 of the code is the System DSN, which can be added and configured through the Windows Control Panel. On the Control Panel screen, the user would click the ODBC Data Sources icon, select the System DSN tab, add the Microsoft SQL Server driver (if it has not already been added), and configure by identifying the server on which SQL Server resides. In line 2, DSN is the name of the server identified in the configuration. The audiometric calculations software produces (1) standard reports in Microsoft Excel format, including pivot tables, (2) updated audiometric data in Microsoft Access tables which are added (through IT security) to the SQL Server database, and (3) validation reports. The standard and validation reports are written to a shared drive on which they are made available to individual users on the network. Any necessary data correction based on the validation reports is sent through IT, which implements the corrections in the SQL Server database. An ExxonMobil Audiometric Studies website is a planned extension of the system. It would make the Excel reports, validation reports, and news, trends and summaries available to designated users via a company intranet and the web. Analytical Engine Data The audiometric statistics are derived from data from audiometric tests administered annually to employees exposed to noise. Audiometric tests measure hearing at various frequencies. The audiometric data are merged with data describing other characteristics of the individual such as work location, occupation, age, department, job code, and others, stored in several tables in the OHM Page 1

Figure 1 data warehouse, using Proc SQLs similar to Figure 2. Methods The following standards were used to measure hearing loss. "Age-adjusted" means normalized using a standard OSHA table of expected hearing loss due to age. 1. OSHA 25dB: OSHA age-adjusted 25 db change from baseline in 2, 3 and 4 KHz. (This is the current OSHA standard used in the U.S.) 2. OSHA 15dB: OSHA age-adjusted 15 db change from baseline in 2, 3 and 4 KHz. (This is a possible future OSHA standard.) 3. OSHA 10dB: OSHA age-adjusted 10 db change from baseline in 2, 3 and 4 KHz. (This is the current OSHA STS standard.) 4. ExxonMobil Corporate: Average 25dB change from audiometric zero in 3, 4, 6 KHz and average 15dB change from baseline in 3, 4, 6 KHz. Age adjustment is not used. Figure 2 PROC SQL; CONNECT TO ODBC (DSN=OHMSQL7); CREATE TABLE lib01.employee AS SELECT * FROM CONNECTION TO ODBC (SELECT l500k, l1k, l2k, l3k, l4k, l6k, l8k, r500k, r1k, r2k, r3k, r4k, r6k, r8k, rec_num, employeenum, date, time, testtype, exposure, protect, company, location, department, jobcode, workshift, adiologs FROM audiograms); DISCONNECT FROM ODBC; QUIT; Page 2

Analysis It was assumed that the first test in each employee's test history was the original baseline (audiometric zero). In the analysis, baselines were reset after hearing loss events. Each reset event is implemented by setting the value of the corresponding baseline-reset flag to 1. Eight flags (2 ears x 4 methods, above) are created for each test. These flags are attached to the individual test data and they indicate the tests for which baselines should be reset. Using historical test results and flags, the analytical process creates summary statistics for measuring hearing loss in different groups of employees. For example, we report the number of baseline resets during one year for a particular group of employees by method and by ear. Data Validation Data validation is particularly important in this case because test results are entered manually. The process employs two data validation procedures: 1. The first data validation procedure is the generation of an Excel report listing every test containing values outside of specified limits. This Excel report is generated by the audiometric calculation programs (SAS code) and sent to the shared drive on the network. A data quality analyst reviews the report and makes requests to the IT department for corrections to audiometric data in the warehouse. The SAS code in Figure 3 and Excel macros in Figure 4 generate this Excel report. In figure 3, the data step (data _null_) creates a comma-delimited file for use by Excel. The "x" command starts Excel and opens the workbook personal.xls, which contains the Excel macros. The macro variable &excel_files_dir represents the subdirectory containing personal.xls. Each "put" statement in the second data step (data _null_) sends a command to Excel. The "filename ereport..." statement is mandatory. The options statements are recommended. The final two "x" commands move the Excel workbook to the shared drive and delete. The first two "put" statement in the second data _null_ call the Excel macros MakeRed2 and MakeRed2Save (Figure 4). The VBA code was generated primarily by using Excel's "Record Macro" feature. MakeRed2Save was created this way. However, the control structures in MakeRed2 required additional VBA coding. MakeRed2 changes the color of the text in a given cell from black to red if the validation routine found that something is wrong with this datum. Only excerpts are presented below for MakeRed2. 2. The second data validation procedure analyzes all historical test records and flags each record with test results different from both the previous and next subsequent test results for 15 db at least two frequencies. Using techniques similar to those shown in Figures 3 and 4, the system creates an Excel report showing all such records in red for easy identification. Reporting The system generates Excel reports and pivot tables (Figure 5) using programming techniques similar to those described in the Validation section of this article and additional coding to create pivot tables. Excel pivot tables can produce summaries of data from different sources. The simplest situation is an Excel pivot table using data stored in an Excel workbook. However, the pivot table in our system draws data from a Microsoft Access table created by code included in Figure 4. The Proc Export converts the SAS dataset "toexcel" into the Microsoft Access table "lifestage". The "x" command calls Excel and opens the workbook personal.xls. The Excel pivot tables were originally created using Excel's Pivot Table Wizard. In that process, the data source was identified as Microsoft Access. The macros lsimputacces, lsinputaccess2, etc., re-create the pivot tables using current data. The VBA code for these macros was generated using Excel's macro recording facility. The "put" statements in the second data _null_ commands Excel to execute the macros to create the pivot tables, after which the SAS code causes the Excel workbook to be copied to the shared drive and renamed "life_stage.xls". As noted earlier, the "filename ereport" statement is mandatory and the options are recommended. Another data _null_ removes the pivot tables from the original Excel workbook (personal.xls), which still contains the VBA code and is a template for re-use. Conclusions The architecture described in this article combines the analytical capabilities of the SAS System with popular database and spreadsheet applications. Implementation is made relatively simple through a combination of SAS code, Excel VBA code partly generated by recording macros, Excel's pivot table wizard, and using SAS Access for ODBC to easily connect the SAS engine with a Microsoft SQL Server database. While analysis is always the key concern, clear presentation and access through familiar tools are also of great importance to users. Page 3

Contact Information George Bukhbinder Palisades Research, Inc. 75 Claremont Road, Suite 312 Bernardsville, NJ 07924 908-953-8081 gbukhbinder@palisadesresearch.com Figure 3 SAS Code filename except 'd:\audio\flat_files\except.txt'; set exception; length tdate $9 ttype $25; tdate=put(testdate,date9.); ttype=put(testtype,$testt.); file except dsd dlm=','; if _n_=1 then put 'Employee #,' 'Test Date,''Old l2k,' 'New l2k,' 'cl2k,' 'Old l3k,' 'New l3k,''cl3k,' 'Old l4k,' 'New l4k,' 'cl4k,' 'Old r2k,' 'New r2k,''cr2k,' 'Old r3k,' 'New r3k,' 'cr3k,' 'Old r4k,' 'New r4k,''cr4k,' 'Test Type,' ; put employee tdate fldl2k l2k cl2k fldl3k l3k cl3k fldl4k l4k cl4k fldr2k r2k cr2k fldr3k r3k cr3k fldr4k r4k cr4k ttype; %let excel_files_dir=d:\audio\flat_files\ ; options noxsync noxwait; x " 'C:\Program Files\Microsoft Office\OFFICE\EXCEL.EXE' &excel_files_dir.personal.xls"; *sleep for 5 seconds to give EXCEL time to come up; x=sleep(5); filename ereport DDE 'EXCEL SYSTEM'; file ereport ; put '[RUN("MakeRed2",FALSE)]'; put '[RUN("PERSONAL.xls!MakeRed2save", FALSE)]'; put '[ERROR(FALSE)]'; put '[QUIT()]'; x=sleep(5); options xsync noxwait; x copy &excel_files_dir.exception_report.xls "&sharedir."&subdir.\exception_reports; x del &excel_files_dir.exception_report.xls; Page 4

Figure 4 Excel macros Sub MakeRed2()... Range("E2").Select ActiveWorkbook.Names.Add Name:="cl2k_1", RefersToR1C1:="=except!R2C5" Dim strtestblank As Boolean Dim icounter As Integer For icounter = 0 To 5 Next... End Sub strtestblank = False Application.Goto ("cl2k_1") ActiveCell.Offset(0, 3 * icounter).select Do While strtestblank = False If ActiveCell.Value = 1 Then ActiveCell.Offset(0, -1).Font.Color = RGB(255, 0, 0) ActiveCell.Offset(0, -2).Font.Color = RGB(255, 0, 0) ActiveCell.Offset(0, -1).Font.Bold = True ActiveCell.Offset(0, -2).Font.Bold = True End If ActiveCell.Offset(1, 0).Select If ActiveCell.Value = "" Then strtestblank = True End If Loop Sub MakeRed2save() End Sub ActiveWorkbook.SaveAs FileName:="D:\Audio\Flat_Files\Exception_Report.xls", _ FileFormat:=xlNormal, Password:="", WriteResPassword:="", _ ReadOnlyRecommended:=False, CreateBackup:=False Page 5

Figure 5 SAS Code and Excel Macros proc export data=toexcel1 outtable="lifestage" DBMS=ACCESS2000 REPLACE; DATABASE="D:\audio\documents\db1.mdb"; %let excel_files_dir=d:\audio\flat_files\ ; options noxsync noxwait; x " 'C:\Program Files\Microsoft office\office\excel.exe' &excel_files_dir.personal.xls"; *sleep for 5 seconds to give EXCEL time to come up; x=sleep(5); filename ereport DDE 'EXCEL SYSTEM'; file ereport ; put '[RUN("lsimputaccess",FALSE)]'; put '[RUN("lsinputaccess2",FALSE)]'; put '[RUN("lstest3",FALSE)]'; put '[RUN("lstest4",FALSE)]'; put '[RUN("lstest6",FALSE)]'; put '[RUN("lstest7",FALSE)]'; put '[RUN("lstest8",FALSE)]'; put '[RUN("lstest9",FALSE)]'; put '[ERROR(FALSE)]'; put '[SAVE()]'; put '[QUIT()]'; *sleep for 5 seconds to give EXCEL time to close; x=sleep(5); options xsync noxwait; x copy &excel_files_dir.personal.xls "&sharedir."&subdir.\standard_reports; x cd "&sharedir."; x cd &subdir\standard_reports; x rename personal.xls life_stage.xls; options noxsync noxwait; x " 'C:\Program Files\Microsoft Office\OFFICE\EXCEL.EXE' &excel_files_dir.personal.xls"; *sleep for 5 seconds to give EXCEL time to come up; x=sleep(5); file ereport ; put '[RUN("delete",FALSE)]'; put '[ERROR(FALSE)]'; put '[SAVE()]'; put '[QUIT()]'; *sleep for 3 seconds to give EXCEL time to close; x=sleep(3); Page 6