Hi @momi,
Contrary to my initial perception, the features of the LOGISTIC statement of PROC POWER do not seem to exactly match your requirements.
But I think you can obtain the desired sample size using options 1 and 2 of my earlier post. Please find SAS code below for both options:
First, I determine the required sample size per group for a likelihood-ratio chi-square test to compare k=5 independent proportions with given reference proportion (0.4), odds ratios (3, 2.5, 1.8, 1.5), alpha (0.05) and power (0.90), using the formula mentioned in my earlier post. Then I perform a simulation (with 100,000 iterations) to determine the actual power of the test, given that sample size (run time: about 30 s on my workstation).
In the example, the result is n=87 per group and the estimated actual power is 0.9096 with an exact 95% CI of (0.9078, 0.9113). You can easily compute the power for other values of n by setting, say, %let n=85; and then re-running the simulation (i.e. fine-tune the sample size). As it turns out in this example, even with only n=85 per group the lower 95% confidence limit of the power estimate is 0.9000.
%let k=5; /* number of groups */
%let alpha=0.05;
%let power=0.90;
%let p0=0.4; /* reference proportion (in group 0) */
%let oddsr=3 2.5 1.8 1.5; /* list of odds ratios (group 1 vs. group 0, group 2 vs. group 0, ...) */
%let nsim=100000; /* number of iterations in simulation */
%let q=%sysfunc(quantile(chisq,%sysevalf(1-&alpha),&k-1));
%Bisect(cdf('chisq',&q,&k-1,x)=%sysevalf(1-&power),0,1E5,1E-12); /* macro source code from
http://analytics.ncsu.edu/sesug/2007/PO21.pdf */
/* Sample size estimation based on formula from
Chow, S.C., Shao, J., and Wang, H. (2008): Sample Size Calculations in Clinical Research, 2nd ed.,
Chapman & Hall/CRC Press/Taylor & Francis Group, New York, p. 149 */
data _null_;
array r[0:%eval(&k-1)] _temporary_ (1 &oddsr);
array p[0:1,0:%eval(&k-1)] _temporary_;
do j=0 to &k-1;
p[1,j]=1/(1+(1/&p0-1)/r[j]);
P[0,j]=1-p[1,j];
end;
do j=0 to &k-1;
p0_+p[0,j];
p1_+p[1,j];
end;
do j=0 to &k-1;
s+(p[0,j]-p0_/&k)**2/p0_+(p[1,j]-p1_/&k)**2/p1_;
end;
n=ceil(&root/s/&k);
call symputx('n',n);
put 'n = ' n 'per group';
run;
/* Simulation to determine the actual power, given the sample size determined above */
data sim;
call streaminit(314159);
array r[0:%eval(&k-1)] _temporary_ (1 &oddsr);
array p[0:%eval(&k-1)] _temporary_;
do j=0 to &k-1;
p[j]=1/(1+(1/&p0-1)/r[j]);
end;
do m=1 to ≁
do g=0 to &k-1;
y=1; f=rand('binom', p[g], &n); output;
y=0; f=&n-f; output;
end;
end;
run;
ods listing close;
ods output ChiSq=stats(keep=statistic prob where=(statistic=:'L'));
proc freq data=sim;
by m;
weight f;
tables y*g / chisq;
run;
ods listing;
data lrchi;
set stats(keep=prob);
sig=(prob<&alpha);
run;
ods exclude BinomialTest;
proc freq data=lrchi;
tables sig / binomial(level='1');
run;
... View more