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

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts
no text concepts found
Transcript
Integrating SAS and Microsoft Office for Analysis and Reporting of
Hearing Loss in Occupational Health Management
George Bukhbinder, Palisades Research, Inc., Bernardsville, NJ
Michael Krumenaker, Palisades Research, Inc., Bernardsville 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 repeated every year or every other year.
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 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 userfriendly 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. An ExxonMobil
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, click the ODBC Data Sources icon,
and 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 = 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 or bi-annually to
employees exposed to noise. Audiometric tests measure
hearing at various frequencies. The audiometric data is
merged with data describing other characteristics of the
individual such as work location, occupation, age,
department, job code, and others, stored in several tables
Figure 1
in the OHM data warehouse, using Proc SQLs similar to
Figure 2.
Methods
The following standards were used to measure hearing
loss in individuals:
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.)
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;
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.
Analysis
It was assumed that the first test in each employee's test
history was the original baseline. 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 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 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 data.
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 for 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.
Contact Information
George Bukhbinder
Palisades Research, Inc.
75 Claremont Road, Suite 312
Bernardsville, NJ 07924
908-953-8081
[email protected]
Figure 3
SAS Code
filename except 'd:\audio\flat_files\except.txt';
data _null_;
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;
run;
%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;
data _null_;x=sleep(5);run;
filename ereport DDE 'EXCEL|SYSTEM';
data _null_;
file ereport ;
put '[RUN("MakeRed2",FALSE)]';
put '[RUN("PERSONAL.xls!MakeRed2save", FALSE)]';
put '[ERROR(FALSE)]';
put '[QUIT()]';
run;
data _null_;x=sleep(5);run;
options xsync noxwait;
x copy &excel_files_dir.Exception_Report.xls "&sharedir."&subdir.\exception_reports;
x del &excel_files_dir.Exception_Report.xls;
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
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
Next
. . .
End Sub
Sub MakeRed2save()
ActiveWorkbook.SaveAs FileName:="D:\Audio\Flat_Files\Exception_Report.xls", _
FileFormat:=xlNormal, Password:="", WriteResPassword:="", _
ReadOnlyRecommended:=False, CreateBackup:=False
End Sub
Figure 5
SAS Code and Excel Macros
proc export data=toexcel1 outtable="lifestage" DBMS=ACCESS2000 REPLACE;
DATABASE="D:\audio\documents\db1.mdb";
run;
%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;
data _null_;x=sleep(5);run;
filename ereport DDE 'EXCEL|SYSTEM';
data _null_;
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()]';
run;
*sleep for 5 seconds to give EXCEL time to close;
data _null_;x=sleep(5);run;
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;
data _null_;x=sleep(5);run;
data _null_;
file ereport ;
put '[RUN("delete",FALSE)]';
put '[ERROR(FALSE)]';
put '[SAVE()]';
put '[QUIT()]';
run;
*sleep for 3 seconds to give EXCEL time to close;
data _null_;x=sleep(3);run;