alpha/2 to alpha in the 2nd
line of code after the ;
data
;
**;
data a;
input power alpha pie1 pie2 n;
cards;
0.80 0.05 0.07 0.12 − 9
;
data a; set a;
pza=abs(probit(alpha/2)); /
pza=significance level as a z
score
ie 5%=1.96
*/
diff= (abs (pie1−pie2))*2;
pieval= ((piel(1−pie1)) +
(pie2(1−pie2)));
if n=−9 then do; / Find n
flag=1;
pz=probit(power); /
pz=cumulative z value for given
power
/
function= (pz + pza)*2; /
function=power function /
n=ceil((functionpieval)/diff);
end;
else if power=−9 then do; /
Find power /
flag=2;
function= (ndiff)/pieval;
pz=sgrt (function) −pza;
power=round (abs
(probnorm(pz)),.01) ;
end;
/ Print
out results /
title1 'Comparison of two Proportions
(independent groups)';
proc print split ='';
where flag=1; / found
n /
id power;
var alpha pie1 pie2 n;
label n='CALCULATED VALUE* OF N
(PER GROUP)';
title3 ‘Finding number of subjects
(n)’;
Appendix 354