45
UCB CALSTAPH EXCEL AND EPIDEMIOLOGY Gail Sondermeyer Cooksey, MPH Infectious Diseases Branch California Department of Public Health [email protected] PRESENTATION NOT APPROVED BY CDPH

UCB CalSTAPH Excel and Epidemiology · Excel & epidemiology • Data cleaning • Analysis • Presentation • Excel functionalities • Functions – type formulas into cells

Embed Size (px)

Citation preview

UCB CALSTAPH EXCEL AND EPIDEMIOLOGY Gail Sondermeyer Cooksey, MPH Infectious Diseases Branch California Department of Public Health [email protected]

PRESENTATION NOT APPROVED BY CDPH

Overview • Introduction • Functions • Point and Click • Excel & CDPH • Excel & other programs

*See corresponding Excel sheet for examples

PRESENTATION NOT APPROVED BY CDPH

Overview • Introduction • Functions • Point and Click • Excel & CDPH • Excel & other programs

*See corresponding Excel sheet for examples

PRESENTATION NOT APPROVED BY CDPH

Introduction – Why use Excel? • Pros

• Easy to access – cheaper and available on most computers

• Easy to view and edit data and do basic analysis with little training

• Customizable data visualization (tables and graphs)

• Cons • Not a powerful analysis tool • Limits to the amount of data

• 1,048,576 rows by 16,384 columns • Relatively easy to corrupt

PRESENTATION NOT APPROVED BY CDPH

Introduction – How epis use Excel • With other programs…SAS, STATA, etc.

• Example 1 (large dataset >1 million records): • Data cleaning, management, and analysis in SAS • Export results to Excel to make tables and graphs

• Example 2 (small “messy” dataset): • Basic data cleaning and review in Excel • Data management and analysis in SAS • Create tables and graphs in Excel

PRESENTATION NOT APPROVED BY CDPH

Introduction • Excel & epidemiology

• Data cleaning • Analysis • Presentation

• Excel functionalities • Functions – type formulas into cells • Point and click • Other

• Macros

PRESENTATION NOT APPROVED BY CDPH

Introduction

PRESENTATION NOT APPROVED BY CDPH

Overview • Introduction • Functions • Point and Click • Excel & CDPH • Excel & other programs

*See corresponding Excel sheet for examples

PRESENTATION NOT APPROVED BY CDPH

Functions • How to use:

• Type formulas into cells =fxn(cell range) • Add cell ranges by typing in text or highlighting

rows/columns e.g. =sum(F2:F5)

• Useful for data analysis and cleaning • See Excel sheet for examples

PRESENTATION NOT APPROVED BY CDPH

PRESENTATION NOT APPROVED BY CDPH

Functions • Double click cells with a formula to see what cell ranges

are used in the calculation

• Move or adjust blue box as needed (pull handle) • Hit ESC to get out of formula without editing

PRESENTATION NOT APPROVED BY CDPH

Functions • Drag formula across or down to repeat for corresponding

cells

• To hold a formula or piece of a formula constant add an $

PRESENTATION NOT APPROVED BY CDPH

Overview • Introduction • Functions • Point and Click • Excel & CDPH • Excel & other programs

*See corresponding Excel sheet for examples

PRESENTATION NOT APPROVED BY CDPH

Point and click • How to use:

• Use tool bar at the top of the page

• Useful for data analysis and cleaning • See Excel sheet for examples

PRESENTATION NOT APPROVED BY CDPH

Home

• Wrap Text • Merge & Center • Number formatting • Conditional Formatting • Format as Table

PRESENTATION NOT APPROVED BY CDPH

Home > Wrap Text

PRESENTATION NOT APPROVED BY CDPH

Home > Merge & Center

PRESENTATION NOT APPROVED BY CDPH

Home > Number Formatting

PRESENTATION NOT APPROVED BY CDPH

Home > Format as Table

PRESENTATION NOT APPROVED BY CDPH

Home > Format as Table

• Easy sort and filter

PRESENTATION NOT APPROVED BY CDPH

Home > Conditional Formatting

PRESENTATION NOT APPROVED BY CDPH

Home > Conditional Formatting

• If Format as Table then use Conditional Formatting – can sort by color

PRESENTATION NOT APPROVED BY CDPH

Insert

• PivotTable • Charts • Sparklines

PRESENTATION NOT APPROVED BY CDPH

Insert > PivotTable

PRESENTATION NOT APPROVED BY CDPH

Insert > PivotTable

PRESENTATION NOT APPROVED BY CDPH

Insert > Chart

PRESENTATION NOT APPROVED BY CDPH

Insert > Chart

• Click bars/lines to see range of data shown • Move boxes like with functions

PRESENTATION NOT APPROVED BY CDPH

Insert > Numbers and Rates

• Right click the Rates bar > Format Data Series > Series Options > Plot Series on Secondary Axis

• Right click the new Rates bar > Change Series Chart Type > Line

PRESENTATION NOT APPROVED BY CDPH

Insert > Numbers and Rates

• Right click the Rates bar > Format Data Series > Series Options > Plot Series on Secondary Axis

• Right click the new Rates bar > Change Series Chart Type > Line

PRESENTATION NOT APPROVED BY CDPH

Insert > Sparklines

PRESENTATION NOT APPROVED BY CDPH

Page Layout

• Print Titles • Breaks

PRESENTATION NOT APPROVED BY CDPH

Data

• Sort • Filter • Remove Duplicates • Text to Columns

PRESENTATION NOT APPROVED BY CDPH

Data > Text to Columns

PRESENTATION NOT APPROVED BY CDPH

View

• Zoom to Selection • Freeze Panes

PRESENTATION NOT APPROVED BY CDPH

Other notes: • Copy, Cut & Paste

• Copy (Ctrl+C), Cut (Ctrl+X), Paste (Ctrl+V) • Right click > Paste

• Paste text, formula, transpose, format, Paste Special

• Find & Replace • Find (Ctrl+F), Replace (Ctrl+H)

• Ctrl+Shift+Arrows • Use to quickly highlight rows

and/or columns in table • Ctrl+A

• Use to quickly highlight entire table PRESENTATION NOT APPROVED BY CDPH

Other notes:

• Hiding/Unhiding • Right click column, row,

or tab • Double click to resize columns or rows

• Highlight rows or columns to resize similarly

PRESENTATION NOT APPROVED BY CDPH

Other notes: • Macros: http://www.howtogeek.com/162975/geek-school-learn-how-to-use-excel-macros-to-automate-tedious-tasks/ • Add Developer tab > File > Options > Customize Ribbon >

Check Developer under Customize the Ribbon on the right > OK

• [Record Macro] Useful for repeating actions on different iterations of the same dataset

• Difficult to edit after created (VBA code)

PRESENTATION NOT APPROVED BY CDPH

Overview • Introduction • Functions • Point and Click • Excel & CDPH • Excel & other programs

*See corresponding Excel sheet for examples

PRESENTATION NOT APPROVED BY CDPH

Excel and CDPH

PRESENTATION NOT APPROVED BY CDPH

Overview • Introduction • Functions • Point and Click • Excel & CDPH • Excel & other programs

*See corresponding Excel sheet for examples

PRESENTATION NOT APPROVED BY CDPH

Excel and other programs

• General tips: • Excel not regarded as reliable/powerful analysis tool • Can become corrupted (e.g. “ghost”) • Whenever you import/export Excel files:

• Check leading zeros (especially in IDs) • Check date formats • Check missing values • Check for truncated data • There is a limit to how much data Excel can manage • Make sure data element names are valid if exporting (e.g.

SAS no spaces, begins with letter, etc.)

PRESENTATION NOT APPROVED BY CDPH

Excel and other programs

• SAS • Free SAS programming 1 tutorial includes

using SAS with Excel • https://support.sas.com/edu/elearning.html?c

try=us&productType=library • Export SAS results as HTML and you can

copy and paste to Excel Tools > Options > Results > Create HTML

• May want to highlight entire Excel sheet beforehand and change to Text

PRESENTATION NOT APPROVED BY CDPH

Excel and other programs

• SAS Concatenation • Using formula with & to concatenate • Helpful for quickly writing SAS code to recode data elements

PRESENTATION NOT APPROVED BY CDPH

Data Tasks & Fake Data

• See Excel sheet

PRESENTATION NOT APPROVED BY CDPH

Thanks! Questions? • Feel free to contact me at: [email protected] or [email protected]

PRESENTATION NOT APPROVED BY CDPH