# How to properly represent right censoring in the data for Surv?

I have survival data on patients, coming from a clinic's datawarehouse. I want to do a survival analysis. The timeframe starts on the day a patient gets a certain examination, and ends 730 days (two years) later.

The data comes in with timestamps.

patient examination.date date.of.death date.of.last.contact comment
A 01.01.2000 NA 01.01.2010 Alive
B 01.02.2000 NA 01.03.2000 Lost to followup
C 01.03.2000 01.04.2000 01.04.2000 Died during study
D 01.04.2000 01.04.2010 01.04.2010 Died after study

So far, I have transformed the data to have the length of actual survival times, and an event column.

patient surv.time event comment
A NA FALSE Alive
B NA FALSE Lost to followup
C 31 TRUE Died during study
D 3653 FALSE Died after study

Surv seems to take no argument for a time of last contact, so I am quite certain that I should at least make a correction for patient B, who was lost to followup, and enter 28 there (the duration between examination and last contact). Patient C is also quite clear: died during the study, and the duration until death is entered.

But my question is about the other two patients:

• should I enter 730 (the study duration) for patients like A, who lived beyond the end of the study?
• should I enter 730 for patients like D, who died after the study timeframe? Note that I have already set the event column to FALSE for these cases.

I read some examples on how to use the survival package, but they used very simplified cases with already-prepared datasets.

Patient A should have time = 730 and event = FALSE. They were censored at the end of the study. EDIT: EdM makes a good point that this depends on whether Patient A was actually studied for a longer period of time, like Patient D apparently was. If A was followed after the original 730 days, then we have to make the same decision for A as we make for D below, either to censor at 730 days or at the time when we actually stopped observing them.

Patient D's data is very unusual. In typical studies there are three possibilities:

1. The patient died during the study (event = TRUE, with event time).
2. The patient was lost to follow-up (event = FALSE, at last observed time).
3. The patient was alive at the end of the study (event = FALSE, last observed time is the end of the study).

It seems from your description that you kept observing patient D long after the "study" ended, which doesn't make sense. If the study is over, how are you still collecting data? But, given that you apparently have this data I think there are two ways to proceed.

1. Enter the data as though the study really did continue until they died, time = 3653 and event = TRUE

2. Enter the data as though they were censored at the end of the study, time = 730 and event = FALSE

If you're using a Cox proportional hazards model and patient D is the only one who is alive and uncensored after time 730 then the results will be identical for the two methods. If you're using a parametric regression or estimating survival curves then I think the results will depend on what you choose.

• I agree in principle (+1), although the way to handle Patient A depends on the decision made about Patient D. It seems that Patient A was followed for 10 years. So if Patient D is handled according to your first suggestion, the censoring time for Patient A should be at 3653 days, through last follow up. If Patient D is handled according to your second suggestion, then censoring Patient A at 730 days makes sense. Also, for completeness, Patient B should have a censoring time at 29 days (if these are dd.mm.yyyy date formats with 2000 being a leap year).
– EdM
May 6, 2021 at 17:30