TWOSAMPLEFREQ Statement 
The TWOSAMPLEFREQ statement performs power and sample size analyses for tests of two independent proportions. Pearson’s chisquare, Fisher’s exact, and likelihood ratio chisquare tests are supported.
Table 70.19 summarizes categories of options available in the TWOSAMPLEFREQ statement.
Task 
Options 

Define analysis 

Specify analysis information 

Specify effects 

Specify sample size and allocation 

Specify power 

Control sample size rounding 

Control ordering in output 
Table 70.20 summarizes the valid result parameters for different analyses in the TWOSAMPLEFREQ statement.
Analyses 
Solve For 
Syntax 

TEST=FISHER 
Power 

Sample size 

TEST=LRCHI 
Power 

Sample size 

TEST=PCHI 
Power 

Sample size 

specifies the level of significance of the statistical test. The default is 0.05, corresponding to the usual 0.05 100% = 5% level of significance. See the section Specifying Value Lists in Analysis Statements for information about specifying the numberlist.
specifies the two independent proportions, and . See the section Specifying Value Lists in Analysis Statements for information about specifying the groupednumberlist.
specifies the two group sample sizes. See the section Specifying Value Lists in Analysis Statements for information about specifying the groupednumberlist.
specifies the sample size allocation weights for the two groups. This option controls how the total sample size is divided between the two groups. Each pair of values for the two groups represents relative allocation weights. Additionally, if the NFRACTIONAL option is not used, the total sample size is restricted to be equal to a multiple of the sum of the two group weights (so that the resulting design has an integer sample size for each group while adhering exactly to the group allocation weights). Values must be integers unless the NFRACTIONAL option is used. The default value is (1 1), a balanced design with a weight of 1 for each group. See the section Specifying Value Lists in Analysis Statements for information about specifying the groupednumberlist.
enables fractional input and output for sample sizes. See the section Sample Size Adjustment Options for information about the ramifications of the presence (and absence) of the NFRACTIONAL option.
specifies the common sample size per group or requests a solution for the common sample size per group with a missing value (NPERGROUP=.). Use of this option implicitly specifies a balanced design. See the section Specifying Value Lists in Analysis Statements for information about specifying the numberlist.
specifies the sample size or requests a solution for the sample size with a missing value (NTOTAL=.). See the section Specifying Value Lists in Analysis Statements for information about specifying the numberlist.
specifies the null odds ratio. The default value is 1. This option can be used only with the ODDSRATIO= option in the TEST=PCHI analysis. See the section Specifying Value Lists in Analysis Statements for information about specifying the numberlist.
specifies the null proportion difference. The default value is 0. This option can be used only with the GROUPPROPORTIONS= or PROPORTIONDIFF= option in the TEST=PCHI analysis. See the section Specifying Value Lists in Analysis Statements for information about specifying the numberlist.
specifies the null relative risk. The default value is 1. This option can be used only with the RELATIVERISK= option in the TEST=PCHI analysis. See the section Specifying Value Lists in Analysis Statements for information about specifying the numberlist.
specifies the odds ratio . See the section Specifying Value Lists in Analysis Statements for information about specifying the numberlist.
controls how the input and default analysis parameters are ordered in the output. OUTPUTORDER=INTERNAL (the default) arranges the parameters in the output according to the following order of their corresponding options:
The OUTPUTORDER=SYNTAX option arranges the parameters in the output in the same order in which their corresponding options are specified in the TWOSAMPLEFREQ statement. The OUTPUTORDER=REVERSE option arranges the parameters in the output in the reverse of the order in which their corresponding options are specified in the TWOSAMPLEFREQ statement.
specifies the desired power of the test or requests a solution for the power with a missing value (POWER=.). The power is expressed as a probability, a number between 0 and 1, rather than as a percentage. See the section Specifying Value Lists in Analysis Statements for information about specifying the numberlist.
specifies the proportion difference . See the section Specifying Value Lists in Analysis Statements for information about specifying the numberlist.
specifies the reference proportion . See the section Specifying Value Lists in Analysis Statements for information about specifying the numberlist.
specifies the relative risk . See the section Specifying Value Lists in Analysis Statements for information about specifying the numberlist.
specifies the number of sides (or tails) and the direction of the statistical test or confidence interval. See the section Specifying Value Lists in Analysis Statements for information about specifying the keywordlist. Valid keywords and their interpretation are as follows:
onesided with alternative hypothesis in same direction as effect
twosided
upper onesided with alternative greater than null value
lower onesided with alternative less than null value
If the effect size is zero, then SIDES=1 is not permitted; instead, specify the direction of the test explicitly in this case with either SIDES=L or SIDES=U. The default value is 2.
specifies the statistical analysis. TEST=FISHER specifies Fisher’s exact test. TEST=LRCHI specifies the likelihood ratio chisquare test. TEST=PCHI (the default) specifies Pearson’s chisquare test.
To specify the proportions, choose one of the following parameterizations:
individual proportions (by using the GROUPPROPORTIONS= option)
difference between proportions and reference proportion (by using the PROPORTIONDIFF= and REFPROPORTION= options)
odds ratio and reference proportion (by using the ODDSRATIO= and REFPROPORTION= options)
relative risk and reference proportion (by using the RELATIVERISK= and REFPROPORTION= options)
To specify the sample size and allocation, choose one of the following parameterizations:
sample size per group in a balanced design (by using the NPERGROUP= option)
total sample size and allocation weights (by using the NTOTAL= and GROUPWEIGHTS= options)
individual group sample sizes (by using the GROUPNS= option)
This section summarizes the syntax for the common analyses supported in the TWOSAMPLEFREQ statement.
You can use the NPERGROUP= option in a balanced design and express effects in terms of the individual proportions, as in the following statements. Default values for the SIDES= and ALPHA= options specify a twosided test with a significance level of 0.05.
proc power; twosamplefreq test=pchi groupproportions = (.15 .25) nullproportiondiff = .03 npergroup = 50 power = .; run;
You can also specify an unbalanced design by using the NTOTAL= and GROUPWEIGHTS= options and express effects in terms of the odds ratio. The default value of the NULLODDSRATIO= option specifies a test of no effect.
proc power; twosamplefreq test=pchi oddsratio = 2.5 refproportion = 0.3 groupweights = (1 2) ntotal = . power = 0.8; run;
You can also specify sample sizes with the GROUPNS= option and express effects in terms of relative risks. The default value of the NULLRELATIVERISK= option specifies a test of no effect.
proc power; twosamplefreq test=pchi relativerisk = 1.5 refproportion = 0.2 groupns = 40  60 power = .; run;
You can also express effects in terms of the proportion difference. The default value of the NULLPROPORTIONDIFF= option specifies a test of no effect, and the default value of the GROUPWEIGHTS= option specifies a balanced design.
proc power; twosamplefreq test=pchi proportiondiff = 0.15 refproportion = 0.4 ntotal = 100 power = .; run;
The following statements demonstrate a power computation for Fisher’s exact conditional test for two proportions. Default values for the SIDES= and ALPHA= options specify a twosided test with a significance level of 0.05.
proc power; twosamplefreq test=fisher groupproportions = (.35 .15) npergroup = 50 power = .; run;
The following statements demonstrate a sample size computation for the likelihood ratio chisquare test for two proportions. Default values for the SIDES= and ALPHA= options specify a twosided test with a significance level of 0.05.
proc power; twosamplefreq test=lrchi oddsratio = 2 refproportion = 0.4 npergroup = . power = 0.9; run;