SAS IML Sample Size Programs and
PROC POWER Code
Revised November 2015
Douglas G. Bonett
University of California - Santa Cruz
Table of Contents
Part I Sample Size for Desired Precision
Program 1: Sample size to estimate amean 5
Program 2: Sample size to estimate a mean difference (2-group design) 5
Program 3: Sample size to estimate a mean difference (2-group design) with covariates 6
Program 4: Sample size to estimate a mean ratio (2-group design) 6
Program 5: Sample size to estimate a linear contrast of means (between-subjects design) 7
Program 6: Sample size to estimate a linear contrast of means (between-subjects design)
with covariates 7
Program 7: Sample size to estimate mean ratio (paired-samples design) 8
Program 8: Sample size to estimate a mean difference (2-group design) 8
Program 9: Sample size to estimate a linear contrast of means (within-subjects design) 9
Program 10: Sample size to estimate a standardized mean difference (2-group design) 9
Program 11: Sample size to estimate a standardized linear contrast of means
(between-subjects design) 10
Program 12: Sample size to estimate a standardized mean difference (paired-samples design) 10
Program 13: Sample size to estimate a standardized linear contrast of means
(within-subjects design) 11
Program 14: Sample size to estimate a (partial) correlation11
Program 15: Sample size to estimate a slope 12
rogram 16: Sample size to estimate a conditional mean 12
Program 17: Sample size to estimate a squared multiple correlation13
Program 18: Sample size to estimate a Cronbach alpha reliability 13
Program 19: Sample size to estimate aproportion 13
Program 20: Sample size to estimate a proportion difference (2-group design)14
Program 21: Sample size to estimate a linear contrast of proportions 14
(between-subjects design)
Program 22: Sample size to estimate a proportion difference (paired-samples design) 14
Program 23: Sample size to estimate aresidual standard deviation 15
Program 24: Sample size to estimate a ratio of residual standard deviations (2-group design) 15
Program 25: Sample size to estimate aG-index of agreement (2x2 table) 15
Program 26: Second-stage sample size requirement16
Part II Sample Size for Desired Power
Program 27: Sample size to test a mean17
Program 28: Sample size to test a mean difference (2-group design)17
Program 29: Sample size to test a mean difference (2-group design) with covariates18
Program 30: Sample size to testequivalence of mean difference (2-group design)
with covariates19
Program 31: Sample size to test a linear contrast of means (between-subjects design) 19
Program 32: Sample size to test a linear contrast of means (between-subjects design)
with covariates 20
Program 33: Sample size for F-test in one-way ANOVA (between-subjects design)20
Program 34: Sample size to test a mean difference (paired-samples design)21
Program 35: Sample size to testequivalence of mean difference (paired-samples design)21
Program 36: Sample size to test a linear contrast of means (within-subjects design)22
Program 37: Sample size to test a (partial) correlation22
Program 38: Sample size to test a slope23
Program 39: Sample size to test aproportion23
Program 40: Sample size to test a proportion difference (2-group design)24
Program 41: Sample size to test equivalence ofproportion difference (2-group design)24
Program 42: Sample size to test a linear contrast of proportions (between-subjects design) 25
Program 43: Sample size to test a proportion difference (paired-samples design)25
Program 44: Sample size to test equivalence of proportion difference (paired-samples design)26
Program 45: Sample size for Sign test (1-group design)26
Program 46: Sample size for Mann-Whitney test 27
Program 47: Sample size for Sign Test (paired-samples design)27
Program 48: Sample size to test a multiple correlation 27
Program 49: Sample size to test a G-index of agreement (2x2)29
Program 50: Sample size to test a (partial) correlation difference (2-group design)28
Program 51: Sample size to test a Cronbach alpha reliability29
Program 52: Sample size to test a Cronbach alpha reliability differences (2-group design)29
Part III –Power for Specified Sample Size
Program 53: Power to test a mean 30
Program 54: Power to test mean difference (2-group design)30
Program 55: Power to test mean difference (paired-samples design) 30
Program 56: Power to test aproportion 30
Program 57: Power to test a (partial) correlation 31
Program 58: Power to test amultiple correlation 31
Program 59: Power of F-test in one-way ANOVA 31
Program 60: Power of test of linear contrast of means (between-subjects design)31
Part IV–Precision for Specified Sample Size
Program61: Precision of confidence interval for amean 32
Program62: Precision of confidence interval for amean difference (2-group design)32
Program63: Precision of confidence interval for astandardized mean difference (2-group design)33
Program64: Precision of confidence interval for amean difference (paired-samples design)33
Program65: Precision of confidence interval for astandardized mean difference33
(paired-samples design)
Program66: Precision of confidence interval for aproportion 34
Program67: Precision of confidence interval for aproportion difference (2-group design)34
Program68: Precision of confidence interval for aproportion difference (paired-samples design)34
Program69: Precision of confidence interval for a(partial) correlation 35
Program 70: Precision of confidence interval for aCronbach alpha reliability 35
Part V – Miscellaneous Programs
Program 71: Random sample generator 36
Program 72: Compute upper limit for variance planning value36
Part I - Sample Size for Desired Precision
Program 1: Sample size to estimate amean
procIML;
alpha = .05; /*alpha for 1-alpha confidence */
var = 264.4; /*planning value ofDV variance */
w = 10; /*desired confidence interval width */
/* ======*/
reset noname printadv = 0;
optionsnodatenonumbernocenter;
odsgraphicsoff; odshtmlclose; odslisting;
z = probit(1 - alpha/2);
n = int(4*var*(z/w)**2 + z**2/2) + 1;
print"Estimate Mean: One-group Design";
print,,"Desired confidence = " ((1 - alpha)*100)[format = 9.3];
print"Desired CI width = " w [format = 9.3];
print"Variance planning value = " var[format = 9.3];
print ,,"Sample size requirement = " n [format = 9.0];
quit;
Program 2: Sample size to estimateamean difference (2-group design)
procIML;
alpha = .05; /*alpha for 1-alpha confidence */
var = 37.1; /*planning value ofwithin-groupDV variance */
w = 5; /*desired confidence interval width */
/* ======*/
reset noname printadv = 0;
optionsnodatenonumbernocenter;
odsgraphicsoff; odshtmlclose; odslisting;
z = probit(1 - alpha/2);
n = int(8*var*(z/w)**2 + z**2/4) + 1;
print"Estimate Mean Difference: Two-group Design";
print,,"Desired confidence = " ((1 - alpha)*100)[format = 9.3];
print"Desired CI width = " w [format = 9.3];
print"Variance planning value = " var[format = 9.3];
print ,,"Sample size requirement per group = " n [format = 9.0];
quit;
Program 3: Sample size to estimatea mean difference (2-group design) with covariates
procIML;
alpha = .05; /*alpha for 1-alpha confidence */
var = 37.1; /*planning value ofwithin-groupDV variance */
q = 2; /*number of covariates */
sqrcor = .4; /*planning value of squared multiple correlation */
/* between DV and covariates */
d = 0; /* planning value of largest covariate standardized */
/* mean difference (set to 0 for an experiment) */
w = 5; /*desired confidence interval width */
/* ======*/
reset noname printadv = 0;
optionsnodatenonumbernocenter;
odsgraphicsoff; odshtmlclose; odslisting;
z = probit(1 - alpha/2);
n = int(8*var*(1 + d**2/4)*(1 - sqrcor)*(z/w)**2 + z**2/4+q/2) +1;
print"Estimate Mean Difference: Two-group Design with Covariates";
print,,"Desired confidence = " ((1 - alpha)*100)[format = 9.3];
print"Desired CI width = " w [format = 9.3];
print"Variance planning value = " var[format = 9.3];
print"Squared correlationplanning value = "sqrcor[format = 9.3];
print"Largest covariate std mean diff= "d[format = 9.3];
print ,,"Sample size requirement per group = " n [format = 9.0];
quit;
Program 4: Sample size to estimatea mean ratio (2-group design)
procIML;
alpha = .05; /* alpha for 1-alpha confidence */
var = .45; /* planning value of within-group DV variance */
m1 = 3.5; /* mean planning value for group 1 */
m2 = 3.1; /* mean planning value for group 2 */
r = 1.2; /* desired upper to lower confidence interval endpoint ratio */
/* ======*/
reset noname printadv = 0;
optionsnodatenonumbernocenter;
odsgraphicsoff; odshtmlclose; odslisting;
z = probit(1 - alpha/2);
n = int(8*var*(1/m1**2 + 1/m2**2)*(z/log(r))**2 + z**2/4) + 1;
print"Estimate Mean Ratio: Two-group Design";
print ,,"Desired confidence = " ((1 - alpha)*100) [format = 9.3];
print"Desired CI U/L ratio = " r [format = 9.3];
print"Variance planning value = " var [format = 9.3];
print"Group 1 mean planning value = " m1 [format = 9.3];
print"Group 2 mean planning value = " m2 [format = 9.3];
print ,,"Sample size requirement per group = " n [format = 9.0];
quit;
Program 5: Sample size to estimatea linear contrast of means (between-subjects design)
procIML;
alpha = .05; /*alpha for 1-alpha confidence */
var = 5.62; /*planning values of within-group DV variance */
w = 2.0; /*desired confidence interval width */
c = {.5, .5, -1}; /*vector of contrast coefficients */
/* ======*/
reset noname printadv = 0;
optionsnodatenonumbernocenter;
odsgraphicsoff; odshtmlclose; odslisting;
z = probit(1 - alpha/2);
a = nrow(c);
n = int(4*sum(var#h##2)*(z/w)**2 + z**2/(2*a)) + 1;
print"Estimate Linear Contrast of Means: Between-subjects Design";
print,,"Contrast coefficients = " (c`) [format = 5.4];
print"Desired confidence = " ((1 - alpha)*100)[format = 9.3];
print"Desired CI width = " w [format = 9.3];
print"Variance planning value = " var[format = 9.3];
print"Largest covariate std mean diff = "d[format = 9.3];
print ,,"Sample size requirement per group = " n [format = 9.0];
quit;
Program 6: Sample size to estimatea linear contrast of means (between-subjects design) with covariates
procIML;
alpha = .05; /*alpha for 1-alpha confidence */
var = 5.62; /*planning values of within-group DV variance */
q = 1; /* number of covariates */
sqrcor = .4; /* planning value of squared multiple correlation */
d = 0; /* planning value of largest covariate pairwise */
/* standardized mean difference (set to 0 for an */
/* experiment) */
w = 2.0; /*desired confidence interval width */
c = {.5, .5, -1}; /*vector of contrast coefficients */
/* between DV and covariates */
/* ======*/
reset noname printadv = 0;
optionsnodatenonumbernocenter;
odsgraphicsoff; odshtmlclose; odslisting;
z = probit(1 - alpha/2);
a = nrow(c);
n = int(4*sum(var#h##2)*(1 + d**2/4)*(1-sqrcor)*(z/w)**2 + z**2/(2*a) + q/a) +1;
print"Estimate Linear Contrast of Means: Between-subjects Design with Covariates";
print,,"Contrast coefficients = " (c`) [format = 5.4];
print"Desired confidence = " ((1 - alpha)*100)[format = 9.3];
print"Desired CI width = " w [format = 9.3];
print"Variance planning value = " var[format = 9.3];
print"Squared correlationplanning value = "sqrcor[format = 9.3];
print"Eta-squared planning value = "etasqr[format = 9.3];
print ,,"Sample size requirement per group = " n [format = 9.0];
quit;
Program 7: Sample size to estimatemean difference (paired-samples design)
procIML;
alpha = .05; /*alpha for 1-alpha confidence */
var = 265; /*planning value ofDV variance */
cor = .8; /*planning of correlation */
w = 10; /*desired confidence interval width */
/* ======*/
reset noname printadv = 0;
optionsnodatenonumbernocenter;
odsgraphicsoff; odshtmlclose; odslisting;
z = probit(1 - alpha/2);
n = int(8*var*(1 - cor)*(z/w)**2 + z**2/2) + 1;
print"Estimate Mean Difference: Within-subjects Design";
print,,"Desired confidence = " ((1 - alpha)*100)[format = 9.3];
print"Desired CI width = " w [format = 9.3];
print"Variance planning value = " var[format = 9.3];
print"Correlation planning value = "cor [format = 9.3];
print ,,"Sample size requirement = " n [format = 9.0];
quit;
Program 8: Sample size to estimatea mean ratio (paired-samples design)
procIML;
alpha = .05; /* alpha for 1-alpha confidence */
var = 5625; /* planning value of within-group DV variance */
m1 = 200; /* mean planning value for group 1 */
m2 = 280; /* mean planning value for group 2 */
cor = .7; /* correlation planning value */
r = 1.33; /* desired upper to lower confidence interval endpoint ratio */
/* ======*/
reset noname printadv = 0;
optionsnodatenonumbernocenter;
odsgraphicsoff; odshtmlclose; odslisting;
z = probit(1 - alpha/2);
n = int(8*var*(1/m1**2 + 1/m2**2 - 2*cor/(m1*m2))*(z/log(r))**2 + z**2/4) + 1;
print"Estimate Mean Ratio: Two-group Design ";
print ,,"Desired confidence = " ((1 - alpha)*100) [format = 9.3];
print"Desired CI U/L ratio = " r [format = 9.3];
print"Variance planning value = " var [format = 9.3];
print"Group 1 mean planning value = " m1 [format = 9.3];
print"Group 2 mean planning value = " m2 [format = 9.3];
print"Correlation planning value = " cor [format = 9.3];
print ,,"Sample size requirement per group = " n [format = 9.0];
quit;
Program 9: Sample size to estimatea linear contrast of means (within-subjects design)
procIML;
alpha = .05; /*alpha for 1-alpha confidence */
var = 265; /*planning value of largest DVvariance */
cor = .8; /*planning ofsmallest correlation */
w = 10; /*desired confidence interval width */
c = {.5, .5, -.5, -.5}; /*vector of contrast coefficients */
/* ======*/
reset noname printadv = 0;
optionsnodatenonumbernocenter;
odsgraphicsoff; odshtmlclose; odslisting;
z = probit(1 - alpha/2);
n = int(4*var*(c`*c)*(1 - cor)*(z/w)**2 + z**2/2) +1;
print"Estimate Linear Contrast of Means: Within-subjects Design";
print ,,"Contrast coefficients = " (c`)[format = 5.3];
print"Desired confidence = " ((1 - alpha)*100)[format = 9.3];
print"Desired CI width = " w[format = 9.3];
print"Variance planning value = " var[format = 9.3];
print"Correlation planning value = "cor[format = 9.3];
print ,,"Sample size requirement = " n[format = 9.0];
quit;
Program 10: Sample size to estimatea standardized mean difference (2-group design)
procIML;
alpha = .05; /*alpha for 1-alpha confidence */
d = .75; /*planning value of standardized mean difference */
w = .5; /*desired confidence interval width */
/* ======*/
reset noname printadv = 0;
optionsnodatenonumbernocenter;
odsgraphicsoff; odshtmlclose; odslisting;
z = probit(1 - alpha/2);
n = int((d**2 + 8)*(z/w)**2) + 1;
print"Estimate Standardized Mean Difference: Two-group Design";
print,,"Desired confidence = " ((1 - alpha)*100)[format = 9.3];
print"Desired CI width = " w [format = 9.3];
print"Std difference planning value = " d [format = 9.3];
print ,,"Sample size requirement per group = " n [format = 9.0];
quit;
Program 11: Sample size to estimatea standardized linear contrast of means (between-subjects design)
procIML;
alpha = .05; /*alpha for 1-alpha confidence */
d = 1; /*planning value of DV variance */
w = .6; /*desired confidence interval width */
c = {.5, .5, -.5, -.5}; /*vector of contrast coefficients */
/* ======*/
reset noname printadv = 0;
optionsnodatenonumbernocenter;
odsgraphicsoff; odshtmlclose; odslisting;
z = probit(1 - alpha/2);
a = nrow(c);
n = int((2*d**2/a + 4*(c`*c))*(z/w)**2) + 1;
print"Estimate Standardized Linear Contrast of Means: Between-subjects Design";
print ,,"Contrast coefficients = " (c`) [format = 5.3];
print"Desired confidence = " ((1 - alpha)*100)[format = 9.3];
print"Desired CI width = " w [format = 9.3];
print"Standardized contrast planning value = " d [format = 9.3];
print ,,"Sample size requirement per group = "n [format = 9.0];
quit;
Program 12: Sample size to estimatea standardized mean difference (paired-samples design)
procIML;
alpha = .05; /*alpha for 1-alpha confidence */
d = 1; /*planning value ofstandardized mean difference */
cor = .65; /*planning of correlation */
w = .6; /*desired confidence interval width */
/* ======*/
reset noname printadv = 0;
optionsnodatenonumbernocenter;
odsgraphicsoff; odshtmlclose; odslisting;
z = probit(1 - alpha/2);
n = int(4*(d**2*(1+cor**2)/4 + 2*(1-cor))*(z/w)**2) + 1;
print"Estimate Standardized Mean Difference: Within-subjects Design";
print,,"Desired confidence = " ((1 - alpha)*100)[format = 9.3];
print"Desired CI width = " w [format = 9.3];
print"Standardizeddifference planning value = " d [format = 9.3];
print"Correlation planning value = "cor [format = 9.3];
print ,,"Sample size requirement = " n [format = 9.0];
quit;
Program 13: Sample size to estimatea standardized linear contrast of means (within-subjects design)
procIML;
alpha = .05; /*alpha for 1-alpha confidence */
d = 1; /*planning value ofstandardized contrast */
cor = .7; /*planning of correlation */
w = .6; /*desired confidence interval width */
c = {.5, .5, -.5, -.5}; /*vector of contrast coefficients */
/* ======*/
reset noname printadv = 0;
optionsnodatenonumbernocenter;
odsgraphicsoff; odshtmlclose; odslisting;
z = probit(1 - alpha/2);
a = nrow(c);
n = int(4*(d**2*(1+(a-1)*cor**2)/(2*a) + (c`*c)*(1-cor))*(z/w)**2) + 1;
print"Estimate Standardized Linear Contrast of Means: Within-subjects Design";
print ,,"Contrast coefficients = " (c`) [format =5.3];
print"Desired confidence = " ((1 - alpha)*100)[format = 9.3];
print"Desired CI width = " w [format = 9.3];
print"Standardized contrast planning value = " d [format = 9.3];
print"Correlation planning value = "cor [format = 9.3];
print ,,"Sample size requirement = " n [format = 9.0];
quit;
Program 14: Sample size to estimatea (partial) correlation
procIML;
alpha = .05; /*alpha for 1-alpha confidence */
cor = .362; /*planning value of correlation */
s = 0; /*number of control variables */
w = .25; /*desired confidence interval width*/
/* ======*/
reset noname printadv = 0;
optionsnodatenonumbernocenter;
odsgraphicsoff; odshtmlclose; odslisting;
z = probit(1 - alpha/2);
n1 = int(4*((1 - cor**2)**2)*(z/w)**2 + 3 + s) + 1;
zr = log((1 + cor)/(1 - cor))/2;
l = zr - z/sqrt(n1 - 3 - s);
u = zr + z/sqrt(n1 - 3 - s);
ll = (exp(2*l) - 1)/(exp(2*l) + 1);
ul = (exp(2*u) - 1)/(exp(2*u) + 1);
n = int((n1 - 3 - s)*((ul - ll)/w)**2 + 3 + s) + 1;
print"Estimate(partial) Correlation";
print ,,"Desired confidence = " ((1 - alpha)*100) [format = 9.3];
print"Desired CI width = " w [format = 9.3];
print"Correlation planning value = "cor [format = 9.3];
print"Number of control variables = " s [format = 9.0];
print ,,"Sample size requirement = " n [format = 9.0];
quit;
Program 15: Sample size to estimate a slope
procIML;
alpha = .05; /*alpha for 1-alpha confidence */
vw = 30.66; /*planning value of within-group DV variance */
vx = 266.7; /*variance of x */
w = .2; /*desired confidence interval width */
/* ======*/
reset noname printadv = 0;
optionsnodatenonumbernocenter;
odsgraphicsoff; odshtmlclose; odslisting;
z = probit(1 - alpha/2);
n = int((4*vw/vx)*(z/w)**2 + 1 + z**2/2) + 1;
print"Estimate Slope (fixed x)";
print ,,"Desired confidence = " ((1 - alpha)*100) [format = 9.3];
print"Desired CI width = " w [format = 9.3];
print"Within-group planning variance =" vw[format = 9.3];
print"Predictor variable variance = " vx [format = 9.3];
print ,,"Sample size requirement = " n [format = 9.0];
quit;
Program 16: Sample size to estimate a conditional mean
procIML;
alpha = .05; /*alpha for 1-alpha confidence */
vw = 120; /*planning value of within-group DV variance */
vx = 125; /*variance of x */
diff = 15; /*x value minus mean of x */
w = 5; /*desired confidence interval width */
/* ======*/
reset noname printadv = 0;
optionsnodatenonumbernocenter;
odsgraphicsoff; odshtmlclose; odslisting;
z = probit(1 - alpha/2);
n = int(4*(vw*(1+diff**2/vx))*(z/w)**2 + 1 + z**2/2) + 1;
print"EstimateConditional Mean";
print ,,"Desired confidence = " ((1 - alpha)*100) [format = 9.3];
print"Desired CI width = " w [format = 9.3];
print"Within-group planning variance =" vw[format = 9.3];
print"Predictor variable variance = " vx [format = 9.3];
print"x minus mean of x = "diff[format = 9.3];
print ,,"Sample size requirement = " n [format = 9.0];
quit;
Program 17: Sample size to estimate a squared multiple correlation
procIML;
alpha = .05; /*alpha for 1-alpha confidence */
q = 2; /*number of predictor variables */
rsqr = .3; /*squared multiple correlation planning value */
w = .2; /*desired confidence interval width */
/* ======*/
reset noname printadv = 0;
optionsnodatenonumbernocenter;
odsgraphicsoff; odshtmlclose; odslisting;
z = probit(1 - alpha/2);
n = int(16*(rsqr*(1 - rsqr)**2*(z/w)**2 + q + 2)) + 1;
print"Estimate Squared Multiple Correlation";
print ,,"Desired confidence = " ((1 - alpha)*100) [format = 9.3];
print"Desired CI width = " w [format = 9.3];
print ,,"Sample size requirement = " n [format = 9.0];
quit;
Program 18: Sample size to estimatea Cronbach alpha reliability
procIML;
alpha = .05; /*alpha for 1-alpha confidence */
q = 7; /*number of measurements */
r = .8; /*reliability planning value */
w = .1; /*desired lower CI limit */
/* ======*/
reset noname printadv = 0;
optionsnodatenonumbernocenter;
odsgraphicsoff; odshtmlclose; odslisting;
z = probit(1 - alpha/2);
n0 = int((8*q/(q - 1))*(1 - r)**2*(z/w)**2 + 2) + 1;
b = log(n0/(n0 - 1));
LL = 1 - exp(log(1 - r) - b + z*sqrt(2*q/((q - 1)*(n0 - 2))));
UL = 1 - exp(log(1 - r) - b - z*sqrt(2*q/((q - 1)*(n0 - 2))));
w0 = UL - LL;
n = int((n0 - 2)*(w0/w)**2 + 2) + 1;
print"Estimate Cronbach’s Alpha Reliability";
print ,,"Desired confidence = " ((1 - alpha)*100) [format = 9.3];
print"Desired CI width = " w [format = 9.3];
print"Reliability planning value = " r [format = 9.3];
print"Number of measurements = " q [format = 9.3];
print ,,"Sample size requirement = " n [format = 9.0];
quit;
Program 19: Sample size to estimate a proportion
procIML;
alpha = .05; /*alpha for 1-alpha confidence */
p = .4; /*planning value ofproportion */
w = .2; /*desired confidence interval width */
/* ======*/
reset noname printadv = 0;
optionsnodatenonumbernocenter;
odsgraphicsoff; odshtmlclose; odslisting;
z = probit(1 - alpha/2);
n = int(4*p*(1-p)*(z/w)**2) + 1;
print"EstimateProportion: One-group Design";
print ,,"Desired confidence = " ((1 - alpha)*100)[format = 9.3];
print"Desired CI width = " w [format = 9.3];
print"Proportion planning value = "p[format = 9.3];
print ,,"Sample size requirement = " n [format = 9.0];
quit;
Program 20: Sample size to estimatea proportion difference (2-group design)
procIML;
alpha = .05; /*alpha for 1-alpha confidence */
p1 = .1; /*planning value ofproportion 1 */
p2 = .4; /*planning value ofproportion 2 */
w = .15; /*desired confidence interval width */
/* ======*/
reset noname printadv = 0;
optionsnodatenonumbernocenter;
odsgraphicsoff; odshtmlclose; odslisting;
z = probit(1 - alpha/2);
n = int(4*(p1*(1-p1) + p2*(1-p2))*(z/w)**2) + 1;
print"EstimateProportion Difference: Two-group Design";
print ,,"Desired confidence = "((1 - alpha)*100)[format = 9.3];
print"Desired CI width = " w [format = 9.3];
print"Proportion planning values = "(p1||p2)[format = 9.3];
print ,,"Sample size requirement per group = " n [format = 9.0];
quit;
Program 21: Sample size to estimatea linear contrast of proportions (between-subjects design)
procIML;
alpha = .05; /*alpha for 1-alpha confidence */
p = {.3, .5, .6}; /*vector of proportion planning values */
w = .25; /*desired confidence interval width */