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

I have the book Simulating data with SAS by Rick Wicklin and I LOVE it!

 

I am trying to simulate time-to-event data explained in Chapter 7. 

For simulating censored observation, the book explains that both subject who completed the study or dropped out will be censored. Then for the part highlighted in red below, should it be input as 0.7 (0.6+0.1) or just 0.1? See assumptions below:

 

/*******************************************************
* Survival at 2 Years : 60%                              *
* Lost to Follow-up through 2 Years : 10% *

* Study duration: 2 years                                *
********************************************************/
data Data1 (keep= PatientID t Censored);
call streaminit(1234);
HazardRate = -log(0.60)/2;     /* rate at which subject experiences event per year */
CensorRate = -log(XXX)/2; 
EndTime = 2;                                 /* end of study period */
do PatientID = 1 to 200;
tEvent = %RandExp(1/HazardRate);
c = %RandExp(1/CensorRate);
t = min(tEvent, c, EndTime);
Censored = (c < tEvent | tEvent > EndTime);
output;
end;
run;

 

Thanks!

1 ACCEPTED SOLUTION

Accepted Solutions
Rick_SAS
SAS Super FREQ

Lost to Follow-up through 2 Years : 10%

I think you mean that 10% is the rate at which patients would drop out before the end of the study ASSUMING that they don't die from the hazard. If so, then the correct statement is 

CensorRate = -log(0.9)/2; 

because 90% SURVIVE the "dropout hazard".

 

The nice thing about simulation is you can test the code to see if it makes sense:

 


data Sim;
call streaminit(1234);
HazardRate = -log(0.6)/2;
CensorRate = -log(0.9)/2;
EndTime = 2;                                 /* end of study period */
do PatientID = 1 to 500;
   tEvent = rand('Expo', 1/HazardRate);      /* eg, die */
   c = rand('Expo', 1/CensorRate);           /* eg, drop out */
   t = min(tEvent, c, EndTime);              /* time of die, drop out, or study ends */
   Dropout = (c < EndTime);                  /* this person didn't drop out */
   Survived = (tEvent > EndTime);            /* this person didn't die */
   Censored = (c < tEvent | tEvent > EndTime); /* this person dropped out or didn't die */
   output;
end;
run;

proc means data=Sim N mean CLM;
   var Dropout Survived;
run;

proc lifetest data=Sim plots=(survival(atrisk CL));
  time t*Censored(1);
  ods exclude ProductLimitEstimates;
  ods output ProductLimitEstimates=S1;
run;

View solution in original post

5 REPLIES 5
ballardw
Super User

So what is the question? Why 0.60+0.1 at all? Why 0.60+0.1 instead of 0.7?

CHELS
Obsidian | Level 7
Sorry I just edited the post and added some clarification.
ballardw
Super User

I don't have access to the book to be sure of the context. Let's see if @Rick_SAS has some input.

FreelanceReinh
Jade | Level 19

@CHELS wrote:

Then for the part highlighted in red below, should it be input as 0.7 (0.6+0.1) or just 0.1?

I would say 0.9 (=1−0.1) because 10% loss to follow-up leaves 90% of the subjects participating in the study and the processes determining survival and loss to follow-up are assumed to be independent.

Rick_SAS
SAS Super FREQ

Lost to Follow-up through 2 Years : 10%

I think you mean that 10% is the rate at which patients would drop out before the end of the study ASSUMING that they don't die from the hazard. If so, then the correct statement is 

CensorRate = -log(0.9)/2; 

because 90% SURVIVE the "dropout hazard".

 

The nice thing about simulation is you can test the code to see if it makes sense:

 


data Sim;
call streaminit(1234);
HazardRate = -log(0.6)/2;
CensorRate = -log(0.9)/2;
EndTime = 2;                                 /* end of study period */
do PatientID = 1 to 500;
   tEvent = rand('Expo', 1/HazardRate);      /* eg, die */
   c = rand('Expo', 1/CensorRate);           /* eg, drop out */
   t = min(tEvent, c, EndTime);              /* time of die, drop out, or study ends */
   Dropout = (c < EndTime);                  /* this person didn't drop out */
   Survived = (tEvent > EndTime);            /* this person didn't die */
   Censored = (c < tEvent | tEvent > EndTime); /* this person dropped out or didn't die */
   output;
end;
run;

proc means data=Sim N mean CLM;
   var Dropout Survived;
run;

proc lifetest data=Sim plots=(survival(atrisk CL));
  time t*Censored(1);
  ods exclude ProductLimitEstimates;
  ods output ProductLimitEstimates=S1;
run;

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