BookmarkSubscribeRSS Feed
SWEETSAS
Obsidian | Level 7

 

Hello,

I am trying to fit an parametric Weibull accelerated failure time (AFT) model using Lifereg.  The data below is set up in counting process format because I have two covariates (Var1 and Var2) that are time-dependent. The actual time of VISIT is the variable TIME. After transforming the data into counting process format, I have TSTART and TSTOP to hold the beginning and end of an interval. The variable CENSOR indicates whether or not the event occur. Below is my SAS code using LIFEREG. Can anyone help with the following SAS code to reflect time varying covariate. The LIFEREG syntax that allows (tstart,tstop) does not seem to allow specifying censor variable. Any help will be appreciations. I am using SAS 9.4

Thanks 

 

 

proc lifereg  data=have;

class var1 var2;

model time*censor(0)= var1 var2 /dist=weibull;

run;

 

Obs time v1 var2 tstar tstop censor
1 0 0 1 . . 0
2 21 0 1 0 21 0
3 42 0 1 21 42 0
4 56 0 1 42 56 1
5 0 0 1 . . 0
6 1 0 1 0 1 1
7 0 1 0 . . 0
8 21 1 0 0 21 0
9 42 1 0 21 42 0
10 63 1 0 42 63 0
11 84 1 0 63 84 0
12 105 1 0 84 105 0
13 126 1 0 105 126 0
14 147 1 0 126 147 0
15 168 1 0 147 168 0
16 189 1 0 168 189 0
17 210 1 0 189 210 0
18 231 1 0 210 231 0
19 252 1 0 231 252 0
20 273 1 0 252 273 0
21 294 1 0 273 294 0
22 315 1 0 294 315 0
23 336 1 0 315 336 0
24 357 1 0 336 357 0
25 360 1 0 357 360 1
26 0 1 0 . . 0
27 21 1 0 0 21 0
28 42 1 0 21 42 0
29 63 1 0 42 63 0
30 84 1 0 63 84 0

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

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
  • 0 replies
  • 809 views
  • 0 likes
  • 1 in conversation