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!
> 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;
So what is the question? Why 0.60+0.1 at all? Why 0.60+0.1 instead of 0.7?
I don't have access to the book to be sure of the context. Let's see if @Rick_SAS has some input.
@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.
> 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;
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 16. Read more here about why you should contribute and what is in it for you!
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.