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.

Catch up on SAS Innovate 2026

Nearly 200 sessions are now available on demand with the SAS Innovate Digital Pass.

Explore 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
  • 1537 views
  • 0 likes
  • 1 in conversation