# Stata Do Files

## Kaplan-Meier Analysis Using Stata

Need a data set with one observation per person.

Each person either experiences event or is censored.

Need a variable for the time from study entry to date of event or date of censoring/failure
• ( timevariable).
Need a variable indicating whether follow-up ended with the event or with censoring/failure
• ( failvariable)

## Step 1 - SURVIVAL ANALYSIS IN Stata

Step 1 in Kaplan Meier Survival Analysis

## Step 2 - Kaplan-Meier Analysis in Stata

Step 2 in Kaplan-Meier Analysis.

## Step 3 - Graph a Curve from the Kaplan-Meier Estimates in Stata

TO GRAPH A CURVE FROM THE KAPLAN-MEIER ESTIMATES:

Using command line, type:

. sts graph

Step 3: Graph the curve>

## Analysis in Stata10

All of preceding can be done in Stata 10 using its pull-down menus.

Statistics
• Survival Analysis: Setup & Utilities
Use Declare data to be survival-time data to identify time and censoring variables and specify value that indicates failure (eg, 1)

Statistics
• Survival Analysis: Summary statistics, tests, & tables
Use Create survivor, hazard, & other variables to get values of survival function

Use Graph survivor & cumulative hazard functions to get K-M graph
• (or use pull-down Graphics -- Survival analysis graphs)

Jeff Martin, MD