BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Clg
Obsidian | Level 7 Clg
Obsidian | Level 7

Hello,

 

I have a question about an example in the SAS documentation in the proc power.

 

The SAS code is example below:

proc power;
   twosamplefreq test=fm
      proportiondiff = 0.06
      refproportion = 0.32
      nullproportiondiff = -0.02
      sides = u
      ntotal = .
      power = 0.85;
run;

 

I don't understand when is necessary to put NULLPROPORTION as different of 0 ? What does this mean?

 

Thank you,

Clg

1 ACCEPTED SOLUTION

Accepted Solutions
FreelanceReinh
Jade | Level 19

Hello @Clg,

 

Assuming that you mean NULLPROPORTIONDIFF, this is the negative non-inferiority margin in your example, i.e., the −d in section Farrington-Manning (Score) Test of the PROC FREQ documentation (under "Risks and Risk Differences").

 

Example:

Suppose the standard therapy has a response rate of 32% (refproportion). The response rate of the new (experimental) therapy is assumed to be 6 percentage points higher (proportiondiff), i.e., 38%. The aim of the clinical trial is just to show that it's less than 2 percentage points lower (if not higher, of course) because that would suffice to claim that the new therapy is "not inferior" to the standard therapy -- in the sense that a response rate of, say, 30.1% would still be acceptable (perhaps in view of advantages regarding adverse events, costs, etc.).

 

Your PROC POWER step yields:

Farrington-Manning Score Test for Proportion Difference

               Fixed Scenario Elements

Distribution                         Asymptotic normal
Method                            Normal approximation
Number of Sides                                      U
Null Proportion Difference                       -0.02
Reference (Group 1) Proportion                    0.32
Proportion Difference                             0.06
Nominal Power                                     0.85
Alpha                                             0.05
Group 1 Weight                                       1
Group 2 Weight                                       1


Computed N Total

Actual        N
 Power    Total

 0.850     1022

That is, with n=1022/2=511 patients per group we would expect about 85% of a large number of hypothetical non-inferiority trials to confirm (at the alpha=5% level) that the experimental therapy is not inferior to the standard therapy.

 

Let's simulate 100,000 of those trials "Experimental vs. Standard":

%let nsim=100000;
%let n=%eval(1022/2);
%let p1=0.32;
%let pd=0.06;
%let m=0.02; /* PROC FREQ needs the absolute value of the null proportion difference. */

data sim;
call streaminit(27182818);
do i=1 to ≁
  do g='E','S';
    resp=1;
    k=rand('binom', &p1+(g='E')*&pd, &n);
    output;
    resp=0;
    k=&n-k;
    output;
  end;
end;
run;

ods select none;
ods noresults;
ods output pdiffnoninf=pdni;
proc freq data=sim;
by i;
weight k;
tables g*resp / riskdiff(column=2 method=fm noninf margin=&m);
run;
ods select all;
ods results;

proc format;
value pv
low-0.05='significant'
0.05<-high='not significant';
run;

ods exclude binomialtest;
proc freq data=pdni;
format pvalue pv.;
tables pvalue / binomial;
run;

Result:

                               Pr > Z

                                            Cumulative    Cumulative
         PValue    Frequency     Percent     Frequency      Percent
--------------------------------------------------------------------
significant           85197       85.20         85197        85.20
not significant       14803       14.80        100000       100.00


      Binomial Proportion
      PValue = significant

Proportion                0.8520
ASE                       0.0011
95% Lower Conf Limit      0.8498
95% Upper Conf Limit      0.8542

Exact Conf Limits
95% Lower Conf Limit      0.8498
95% Upper Conf Limit      0.8542

Sample Size = 100000

So, the power (0.85) for the sample size obtained by PROC POWER has been confirmed.

 

 

 

View solution in original post

1 REPLY 1
FreelanceReinh
Jade | Level 19

Hello @Clg,

 

Assuming that you mean NULLPROPORTIONDIFF, this is the negative non-inferiority margin in your example, i.e., the −d in section Farrington-Manning (Score) Test of the PROC FREQ documentation (under "Risks and Risk Differences").

 

Example:

Suppose the standard therapy has a response rate of 32% (refproportion). The response rate of the new (experimental) therapy is assumed to be 6 percentage points higher (proportiondiff), i.e., 38%. The aim of the clinical trial is just to show that it's less than 2 percentage points lower (if not higher, of course) because that would suffice to claim that the new therapy is "not inferior" to the standard therapy -- in the sense that a response rate of, say, 30.1% would still be acceptable (perhaps in view of advantages regarding adverse events, costs, etc.).

 

Your PROC POWER step yields:

Farrington-Manning Score Test for Proportion Difference

               Fixed Scenario Elements

Distribution                         Asymptotic normal
Method                            Normal approximation
Number of Sides                                      U
Null Proportion Difference                       -0.02
Reference (Group 1) Proportion                    0.32
Proportion Difference                             0.06
Nominal Power                                     0.85
Alpha                                             0.05
Group 1 Weight                                       1
Group 2 Weight                                       1


Computed N Total

Actual        N
 Power    Total

 0.850     1022

That is, with n=1022/2=511 patients per group we would expect about 85% of a large number of hypothetical non-inferiority trials to confirm (at the alpha=5% level) that the experimental therapy is not inferior to the standard therapy.

 

Let's simulate 100,000 of those trials "Experimental vs. Standard":

%let nsim=100000;
%let n=%eval(1022/2);
%let p1=0.32;
%let pd=0.06;
%let m=0.02; /* PROC FREQ needs the absolute value of the null proportion difference. */

data sim;
call streaminit(27182818);
do i=1 to &nsim;
  do g='E','S';
    resp=1;
    k=rand('binom', &p1+(g='E')*&pd, &n);
    output;
    resp=0;
    k=&n-k;
    output;
  end;
end;
run;

ods select none;
ods noresults;
ods output pdiffnoninf=pdni;
proc freq data=sim;
by i;
weight k;
tables g*resp / riskdiff(column=2 method=fm noninf margin=&m);
run;
ods select all;
ods results;

proc format;
value pv
low-0.05='significant'
0.05<-high='not significant';
run;

ods exclude binomialtest;
proc freq data=pdni;
format pvalue pv.;
tables pvalue / binomial;
run;

Result:

                               Pr > Z

                                            Cumulative    Cumulative
         PValue    Frequency     Percent     Frequency      Percent
--------------------------------------------------------------------
significant           85197       85.20         85197        85.20
not significant       14803       14.80        100000       100.00


      Binomial Proportion
      PValue = significant

Proportion                0.8520
ASE                       0.0011
95% Lower Conf Limit      0.8498
95% Upper Conf Limit      0.8542

Exact Conf Limits
95% Lower Conf Limit      0.8498
95% Upper Conf Limit      0.8542

Sample Size = 100000

So, the power (0.85) for the sample size obtained by PROC POWER has been confirmed.

 

 

 

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

Register Now

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
  • 1 reply
  • 1565 views
  • 1 like
  • 2 in conversation