Obsidian | Level 7

## Simulating with SAS - Time to Event

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
SAS Super FREQ

## Re: Simulating with SAS - Time to Event

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;
``````
5 REPLIES 5
Super User

## Re: Simulating with SAS - Time to Event

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

Obsidian | Level 7

## Re: Simulating with SAS - Time to Event

Sorry I just edited the post and added some clarification.
Super User

## Re: Simulating with SAS - Time to Event

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

## Re: Simulating with SAS - Time to Event

@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.

SAS Super FREQ

## Re: Simulating with SAS - Time to Event

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;
``````
Discussion stats
• 5 replies
• 381 views
• 4 likes
• 4 in conversation