BookmarkSubscribeRSS Feed
sascrazedpupil
Obsidian | Level 7

Hello, I attempted this problem in SAS Studio, and am not sure if I input the correct code for it. I'd greatly appreciate any help! 

 

Problem:

"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π/ lnπC

 

n=D/(1-%event-free)

 

Example:

90% Power

 

Δ = 2.0

 

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

 

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 = D = 88 / (1-0.30) = 125.7 = 126 1 - %event-free

 

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
B

80%      0.84

90%      1.28

 

Here is my code:

proc power;
twosamplefreq test=fisher
groupproportions= (0.30 0.20)
npergroup=.
power=0.90;
run;
8 REPLIES 8
Reeza
Super User

Since the data is survival data, I don't think twosamplefreq is appropriate, Twosamplesurvival is likely more appropriate.

 

https://www.sas.com/content/dam/SAS/support/en/sas-global-forum-proceedings/2020/4908-2020.pdf

 


@sascrazedpupil wrote:

Hello, I attempted this problem in SAS Studio, and am not sure if I input the correct code for it. I'd greatly appreciate any help! 

 

Problem:

"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π/ lnπC

 

n=D/(1-%event-free)

 

Example:

90% Power

 

Δ = 2.0

 

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

 

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 = D = 88 / (1-0.30) = 125.7 = 126 1 - %event-free

 

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
B

80%      0.84

90%      1.28

 

Here is my code:

proc power;
twosamplefreq test=fisher
groupproportions= (0.30 0.20)
npergroup=.
power=0.90;
run;

 

sascrazedpupil
Obsidian | Level 7
Ok, thank you. I checked with my TA, and she said I only have to write SAS code for the formulas specified in the problem. How do I do that?
Reeza
Super User
I think you can use the formula for D and n with the information in the question.

FYI - a good way to answer these questions is to list the information you have in the question (alpha = 0.5, power=2/1.5 etc), figure out what you need to get to (D/n)
and then if you have the formula's it becomes plug and play. I see the formula for N but not D in your posts.

sascrazedpupil
Obsidian | Level 7
Ok, here's the new code I typed, using the formulas given to me (D is "number of events", and n is "sample size"):

data fep6; set fep6;
Num_events=(4*(1.96+1.282)**2)/log(2)**2;
sample_size= Num_events/(1-0.30);
run;

It's not showing me the answer in my output, how do I fix that?
Reeza
Super User

@sascrazedpupil wrote:

data fep6; set fep6;


Do not code like this, give it a new data set name such as fep7.


data fep7; 
set fep6;
Num_events=(4*(1.96+1.282)**2)/log(2)**2;
sample_size= Num_events/(1-0.30);
run;

proc print data=fep7;
run;

 

sascrazedpupil
Obsidian | Level 7
Thank you! Do I need to have observations for it to give me a numeric Output (Under "Notes" in my Log, it says "No observations read from the data set WORK.FEP6.", since I'm not using any datasets with values, but instead just writing SAS code for the formulas specified in the assignment.
Reeza
Super User
Then remove the SET statement.
SET provides the input data, where there is none in this case it seems.

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!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

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
  • 8 replies
  • 1199 views
  • 3 likes
  • 2 in conversation