Is this the correct way to calculate time to an event(death) for survival analysis? t2death column calculated using SQL as: case when death_dt is not null then death_dt - admission_dt else study_end_dt - admission_dt end as t2death The final data looks like: id time0 study_end_dt admission_dt death_dt t2death 1 2021-05-24 2022-08-31 2021-05-24 NA 464 2 2019-12-10 2022-08-31 2020-01-19 2020-01-23 4 3 2020-10-14 2022-08-31 2020-11-22 2020-12-03 11 4 2021-11-23 2022-08-31 2021-11-26 NA 278 My concern is that there is t2death value for id: 1, 4, but they are still alive. How does a survival analysis algorithm know that they have been censored? Any reading resources or explanation would be greatly appreciated.

Full article content could not be extracted automatically. Read the original below.