BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
Merdock
Quartz | Level 8

I have a dataset with patients who had liver transplant. Some of them were in group 1 (if on drug A at baseline), others were in group 2 (if on drug B at baseline), depending on the immunosuppressive med they were taking. I am interested in seeing how the time of first switch from med A to med B impacts graft survival. The issue is that I am relatively new to survival analysis and have definitely no experience with time-dependent covariates.

 

Given this, I would like to know if anybody can give me a step-by-step on how I could model time of first switch as a time-dependent covariate in a Cox model with time to graft loss as the outcome? I have read a few theoretical, and some more practical tutorials for how to do this in R, so I know I need the data in long format or so-called counting process format with tstart and tstop and all that, but I am still having trouble getting situated and figuring out an action plan for how to analyze this, and in SAS too.

 

Below is a test dataset similar to the one I have, where GROUP=1, if on drug A; 2 if on drug B, and 3 if they switched from A to B;

CENSOR=1, if event (graft failure) happened, 0 otherwise;

 

FUTIME = total follow-up time (months) (=CENSDT – transplant date), where CENSDT (not shown here, is either date of event, or date of last follow-up/death);

 

EVTIME= time of event (months); EVTIME=FUTIME when CENSOR=1, else EVTIME= . ;

 

SWITCHDATE (not shown here) =date of first switch from drug A to drug B;

 

SWITCHTIME=time of first switch from group 1 to group 2 (=SWITCHDATE – transplant date); this will be 0 for those patients who start off on drug B at baseline, and it is FUTIME for those who start off on drug A and never switch.

 

data have;
input ID$ CENSOR$ FUTIME EVTIME SWITCHTIME GROUP$;
datalines;
001	0	1229	.		333		3
002	0	1659	.		343		3
003	0	733	 	.		509		3
004	0	6998	.		1630	3
005	1	1005	1005	558		3
006	1	4726	4726	147		3
007	0	3790	.		2856	3
008	1	672		672		504		3
009	0	5224	.		2648	3
010	0	4143	.		149		3
011	0	4973	.		500		3
012	1	3626	3626	3624	3
013	0	4296	.		3998	3
014	0	977		.		0		2
015	0	2898	.		331		3
016	0	1382	.		1187	3
017	1	1164	1164	1164	1
018	0	1232	.		336		3
019	1	1599	1599	143		3
020	0	1795	.		111		3
021	0	3171	.		3171	1
022	1	483		483		333		3
023	1	824		824		351		3
024	0	662		.		662		3
025	1	597		597		0		2
026	0	1269	.		0		2
027	0	4120	.		4120	1
028	1	621		621		0		2
029	0	3452	.		3452	1
030	0	1842	.		0		2
;
run;
proc print data=have; run; 

 

1 ACCEPTED SOLUTION

Accepted Solutions
pink_poodle
Barite | Level 11
On this page, ctrl-F “ Notice the creation of start and stop variables, which denote the beginning and end intervals defined by hospitalization and death”:
https://stats.oarc.ucla.edu/sas/seminars/sas-survival/. Anything useful?

View solution in original post

4 REPLIES 4
Merdock
Quartz | Level 8
Thank you for the reference. I was actually reading that exact paper right before I posted but I didn't find it very helpful since it uses hypertension as an example of time-dependent binary variable but I'd like to know how to do this for my continuous time-dependent covariate, which is time of first switch. How would I create my (start, tstop] intervals and account for both the event (graft failure/loss) and time to first switch as the time-dependent predictor? I guess I don't really see how time to first switch can even be seen as a time-dependent covariate..
pink_poodle
Barite | Level 11
On this page, ctrl-F “ Notice the creation of start and stop variables, which denote the beginning and end intervals defined by hospitalization and death”:
https://stats.oarc.ucla.edu/sas/seminars/sas-survival/. Anything useful?
Merdock
Quartz | Level 8
@pink_poodle, thanks! At first glance, I think there might actually be something in this article that could indeed be of help. I will need to read it more carefully though and see if I can adapt some of this for my data.

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

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
  • 4 replies
  • 2079 views
  • 5 likes
  • 2 in conversation