Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
From | asb stata <asb.stata@gmail.com> |
To | statalist@hsphsun2.harvard.edu |
Subject | st: Survival Data - Compare hazards by matching on age |
Date | Tue, 9 Mar 2010 02:02:19 -0500 |
There are two groups of subjects in my data. In the first group, all subjects are at risk of dying since age 1. In the second group, each subject becomes at risk of dying from a subject-specific age different from 1. I want to stset the data properly and graph Kaplan-Meier survival curves for the two groups. A sample of data is presented below. id is unique subject id. group is 1 if subjects do not become at risk of dying until flag=1. Subject 1 becomes at risk of dying only at age 2 or after unlike subjects 3 and 4 which become at risk of dying at age 1. died indicates the actual failure event. The data is set as multiple-record-per-subject. I do not want to compare the hazard of exit of the two groups without taking into account the fact that the members of the first group do not become at risk until a certain (variable) age. I want to compare the hazard of exit for the two groups by comparing subjects of the same age across groups. How do I do it in stata? How to match subjects by age and compare hazard of exit? Is there another way besides matching on age? id group flag age died 1 1 0 1 0 1 1 1 2 0 1 1 1 3 0 1 1 1 4 1 2 1 0 1 0 2 1 0 2 0 2 1 0 3 0 2 1 0 4 0 2 1 1 5 0 2 1 1 6 1 3 2 1 1 0 3 2 1 2 0 3 2 1 3 1 4 2 1 1 0 4 2 1 2 0 4 2 1 3 0 4 2 1 4 0 4 2 1 5 1 * * For searches and help try: * http://www.stata.com/help.cgi?search * http://www.stata.com/support/statalist/faq * http://www.ats.ucla.edu/stat/stata/