BookmarkSubscribeRSS Feed
kc
Quartz | Level 8 kc
Quartz | Level 8

Hello,

 

How do I get get the at-risk table by treatment group (variable 'trt') at specific end points say day (0, 100, 200, 300 etc.) from the phreg code below.

 

proc phreg data=meds covs(aggregate) covm;
class trt(ref='B') strata(ref="1");
model (TSTART, TSTOP)*STATUS(0 2) = trt strata/ rl;
hazardratio "A vs. B" trt / diff=ref;
baseline covariates=covd out=outd cmf=_all_/nomean;
id subjid;
run;

Thanks!

1 REPLY 1
Season
Lapis Lazuli | Level 10

You should use the LIFETEST instead of the PHREG procedure for obtaining the at-risk table. Like this:

proc lifetest data=meds;
strata trt(ref='B') strata(ref="1");
time eventtime*status(0,2);
run;

I noticed that you used the counting process style of input in your MODEL statement of the PHREG procedure syntax. You should modify the dataset and store the observed survival time in one variable when applying the code above. The observed survival time is stored in a variable named eventtime in the code I provide.

There is an issue I am not that sure if the LIFETEST procedure can perform well. You mentioned that your post that your were analyzing recurrent events. I checked out the part of SAS Help relating to the LIFETEST procedure and found that while it can readily handle the case of competing-risk analyses, it has no built-in commands for the analysis of recurrent events.

I think maybe you should modify your dataset such that one observation corresponds to one occurrence of event or censoring. For instance, if a subject experienced the event of interest at time 5, 12 and 26 and censored at time 52. Then the subject corresponds to four observations in the dataset, with the variable named eventtime taking values of 5, 12, 26 and 52 respectively and the variable named status taking values of 1 (I designate 1 as occurring the event of interest here), 1, 1 and 0 (or 2) respectively.

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

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
  • 523 views
  • 0 likes
  • 2 in conversation