# Kaplan Meier curve with different time lengths across groups

I'm not too familiar with survival analysis, so this may be a somewhat basic question.

I am interested in the time between two events [$A$ - medication] and [$B$ - time of first treatment], the latter which can be equal to $A$. Specifically, I want to know if this varies across years.

The subjects in question have at least 5 years of data, and I have data from 2001-2011. Because of this, tests on summary statistics won't do (subjects in 2011 have the capacity to have up to 11 years while subjects in 2006 only have the capacity to have 6).

So instead, I'm considering the value $A-B$ to be censored if $B$ falls within one year of the subject entering the dataset, and then constructing a KM curve. However, the time length covered by each group will still end up different, like so:

By visual inspection, the survival curves are different, though only the 2011 vs any other group comparisons are significant by the logrank test.

Alternatively, I can truncate time differences greater than 5 years (considering them censored):

This results in the exact same curve for years <= 5 as expected, however, the logrank test returns more significant differences (2010 vs any other group).

I'm not sure which of these setups is more appropriate.

• You are grouping by year - is it the year of the first treatment? How come later years have more follow-up? You have to be very careful in combining time to event data with calendar year data, because it can get tricky fast. – Aniko Aug 20 '13 at 15:44
• @Aniko It's the year of A (medication of interest), so it's the later years have the possibility of a longer time difference. And yes, I'm wary of the calendar year division, though I'm not sure how else to proceed given that the question of interest is "Has A-B changed over time" – Affine Aug 20 '13 at 16:07
• You can't group subjects based on the timing of a future event. You have to do a forward-looking analysis. The fact that a subject could have gotten medication in 2005 but did not, and finally got it in 2011 is relevant to 2005 as well as 2011 (and all the years in between). You have a time-dependent predictor. It is difficult to make plots for it, but SAS can handle the analysis in PROC PHREG. – Aniko Aug 20 '13 at 16:21
• @Aniko That makes sense. Someone "failing" in a 2011 group is also a censored event for 2010 (though I'm not exactly sure how to set this up, again, not very familiar with survival). However, it seems a forward-looking analysis would answer a different question than we really want - among those that start taking drug B, how long did they wait; versus how long does it take for subjects to reach drug B – Affine Aug 22 '13 at 19:35
• If you are conditioning on having received the medication, then where does the censoring come from? Perhaps you don't know the time of first treatment for some subjects? – Aniko Aug 22 '13 at 19:46