Turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

- Home
- /
- Analytics
- /
- Stat Procs
- /
- Simulating with SAS - Time to Event

Options

- RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page

☑ This topic is **solved**.
Need further help from the community? Please
sign in and ask a **new** question.

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

Posted a month ago
(380 views)

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

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

> *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

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

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

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

Sorry I just edited the post and added some clarification.

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

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

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

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

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

> *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;
```

**Available on demand!**

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

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.