BookmarkSubscribeRSS Feed
SeaMoon_168
Quartz | Level 8

Some patient received an treatment as treated group and some did not as control group. In order to consider "immortal time bias", I coded the treatment as a time-dependent covariate.

For example, there are two patients:

P1 received the treatment 30 days after the start of this study and died 30 days after receiving the treatment.

P2 did not received the treatment and survived at the end of this study (80 days).

Here I code the data as follow:

IDTreatmentTimeDeath
P10300
P11301
P20800

 

Then I just used SAS code to create KM curves

/*Survival curve*/

proc lifetest data=treatment;

time Time*Dearg(0);

strata Treatment;

run;

and run Cox PH model

/*Cox PH Model*/

proc phreg data=treatment;

model Time*Death(0)=treatment;

run;

1 REPLY 1
SeaMoon_168
Quartz | Level 8
I am not sure what I did is right or not? Could anyone who dealt with, immortal time bias, give me some advice on it? Thanks.

sas-innovate-2026-white.png



April 27 – 30 | Gaylord Texan | Grapevine, Texas

Registration is open

Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!

Register now

What is ANOVA?

ANOVA, or Analysis Of Variance, is used to compare the averages or means of two or more populations to better understand how they differ. Watch this tutorial for more.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 1 reply
  • 949 views
  • 0 likes
  • 1 in conversation