BookmarkSubscribeRSS Feed
jenoli525
Calcite | Level 5

Hello,

I am trying to find the estimated relative risk given certain parameters in a power calculation. The example is for a randomized control trial with 5000 in the treatment group and 5000 in the placebo group with an estimated 2% of the placebo with the outcome. 

To solve for the relative risk given these characteristics, I have tried the following code but there is an error message for the RR being missing...even though that is what I am trying to solve for. Any thoughts?

 

proc power;      

twosamplefreq test=pchi

relativerisk= .

refproportion= 0.02

npergroup = 5000       

power = 0.8

run;

1 REPLY 1
FreelanceReinh
Jade | Level 19

Hello @jenoli525 and welcome to the SAS Support Communities!

 

You raise a good point. PROC POWER can solve only for power or sample size (be it total or per group), although asking for relative risk, given power, sample size and reference proportion, is an obvious, legitimate question, at least from a purely mathematical point of view. Maybe they want to nudge you towards specifying the relative risk based on subject-matter considerations, e.g., what is clinically relevant. Technically, it would be no problem at all to extend the capabilities of PROC POWER correspondingly.

 

You can still use the procedure to obtain the desired result:

  1. Set npergroup (or power) to missing and specify a range of relative risks.
  2. Refine and restrict the range to the interval in which the resulting npergroup in the previous step crossed 5000 (or the power crossed 0.8, resp.).
  3. Repeat step 2 until the desired precision is attained.

 

Of course, in your example there are two numeric solutions for the relative risk RR=p2/p1=p2/0.02, depending on whether the second proportion, p2, is less than or greater than reference proportion p1=0.02. In the latter case (the other case is done analogously) you could start with something like:

proc power;
twosamplefreq test=pchi
relativerisk= 1.1 to 2 by 0.1
refproportion= 0.02
npergroup = .
power = 0.8;
run;

In the results you see that the solution for relative risk must be between 1.4 and 1.5:

          Computed N per Group

            Relative    Actual     N per
   Index        Risk     Power     Group

       1         1.1     0.800     80682
       2         1.2     0.800     21109
       3         1.3     0.800      9798
       4         1.4     0.800      5745
       5         1.5     0.800      3826
       6         1.6     0.800      2760
       7         1.7     0.800      2103
       8         1.8     0.800      1668
       9         1.9     0.800      1364
      10         2.0     0.800      1141

So, in the next step you would use:

relativerisk= 1.4 to 1.5 by 0.01

and continue similarly with

relativerisk= 1.43 to 1.44 by 0.001

and

relativerisk= 1.431 to 1.432 by 0.0001

To see more decimals than in the default output of PROC POWER you may want to write the results to an ODS output dataset by using

ods output output=pow;

The final results, obtained with

proc print data=pow;
var rel: np:;
format relativerisk 6.4;
run;

are

       Relative    NPer
Obs      Risk      Group

  1     1.4310      5010
  2     1.4311      5008
  3     1.4312      5006
  4     1.4313      5004
  5     1.4314      5002
  6     1.4315      5000
  7     1.4316      4998
  8     1.4317      4995
  9     1.4318      4993
 10     1.4319      4991
 11     1.4320      4989

So, 1.4315 is the relative risk in question.

The solution with p2<p1 (obtained analogously) is 0.6438.

SAS Innovate 2025: Call for Content

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 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 1 reply
  • 3089 views
  • 0 likes
  • 2 in conversation