BookmarkSubscribeRSS Feed
sascrazedpupil
Obsidian | Level 7

Hello all, I am a SAS Studio student, and I am having trouble with this homework problem. I do not know which procedure to use for this. I'd greatly appreciate any advice. Thanks in Advance!

 

For determining sample size estimates for time dependent (survival) data, usually the number of estimated events (D) (e.g. deaths, rejections, relapse, reops, etc.) must first be calculated.
Once that is established, the total sample size (n) may be derived based on the percentage of patients that remain event-free at the end of the study.
The two equations for D and n are found below. These equations are for the (Parametric) version of sample size determination for Survival Data or Time to Failure data.

 

D = total # of events required α = Z critical value - Type I error Β = Z critical value - Type II error

Δ hazardratio =λΤ/λ= lnπT /lnπC

n=D

 

 

Example:

90% Power

Δ = 2.0

1 - %event-free

D=4(1.96 + 1.282)^2/[ln2]^2= 87.5= 88 events 

This assumes that all participants will be followed until their event.

 

Suppose that previous studies suggest that 30% of subjects remain event-free at the end of trial. Then, sample size n 

n = D/1 - %event-free = 88 / (1-0.30) = 125.7 = 126

 

This number might be further inflated to account for dropout, but we won’t worry about that here.

 

In SAS, write code to calculate D and n for the following scenarios:

 

When alpha = 0.05 and the hazard ratio may be either 2.0 or 1.5, for power = 0.8 and also for power = 0.90. And either 30% or 20% of subjects remain event-free at the end of trial.

 

 

 

Do you see that you will have 8 pair of estimates for D and n in your output? Please include your SAS code. Your estimate for D and n should be in integer form.

 

Note:
Power    Z(subscript B)

80%        0.84

90%        1.28

2 REPLIES 2
SaketChaudhari
Fluorite | Level 6

Hi sascrazedpupil,

I tried to code this problem, and to be honest, I had to go through a few websites that could explain to me what Z(beta) and Z(alpha) were. Also, I have tried to double-guess how you are calculating the total number of events required, using the hazard ratio. I guessed that it must be inside the natural logarithm. 

I could declare a few global variables to do this more easily, but that won't solve your problem of having 8 obs in the final table.

So I went ahead and created 8 obs in my initial data table, for 8 possible selections, from the available values of alpha, power and % event free. (The number of obs would be 2^(number of variables)). I did this using datalines. I don't see how there could be a way to have this more dynamic, and yet have eight obs in the final data table. 

The layout of the code is pretty simple. If you do find any mistake in the formula, then it is going to be easily edittable. 

Please go through the code:

data temp;
input alpha Z_alpha Power  Delta event_free;
datalines;
0.05 1.96 0.8 2 0.3
0.05 1.96 0.8 1.5 0.3
0.05 1.96 0.9 2 0.3
0.05 1.96 0.9 1.5 0.3
0.05 1.96 0.8 2 0.2
0.05 1.96 0.8 1.5 0.2
0.05 1.96 0.9 2 0.2
0.05 1.96 0.9 1.5 0.2
;
run;

data temp2;
set temp;
beta = 1-power;
if power = 0.8 then Z_1_minus_Beta = 0.842;
else Z_1_minus_Beta = 1.28;
D = round((4*(Z_alpha + Z_1_minus_Beta)**2)/(log(delta))**2);
n = round(D/(1-event_free));

run;

proc print data=temp2; run;

This is what the final report looks like:

 

SaketChaudhari_0-1642930154728.png

 

PaigeMiller
Diamond | Level 26

I am having trouble with this homework problem. I do not know which procedure to use for this.

 

Use the DATA step.

--
Paige Miller

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!

SAS Enterprise Guide vs. SAS Studio

What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 2 replies
  • 721 views
  • 1 like
  • 3 in conversation