Contents: |
Purpose / Requirements / Usage / Details / See Also / References |

*PURPOSE:*- Computes the power of a test comparing two independent proportions using the Pearson chi-square statistic. Typically used prospectively (prior to data collection and analysis), power is given for various total sample sizes allowing you to pick the sample size that achieves the desired power or type II error (beta)
*REQUIREMENTS:*- Only Version 6 or later of Base SAS Software is required.
*USAGE:*-
Follow the instructions in the Downloads tab of this
sample to save the %POWER2x2 macro definition. Replace the text within quotes in the following statement with the location of the %POWER2x2 macro definition file on your system. In your SAS program or in the SAS editor window, specify this statement to define the %POWER2x2 macro and make it available for use:
%inc "<location of your file containing the POWER2x2 macro>";

Following this statement, you may call the %POWER2x2 macro. See this discussion of power analysis in 2x2 tables for an example.

These parameters are required:

**p1=***value*- Specifies the success probability for group 1 under the alternative hypothesis. The specified value should be between 0 and 1.
**p2=***value*- Specifies the success probability for group 2 under the alternative hypothesis. The specified value should be between 0 and 1.

This parameter can be specified if the default is not desired:

**level=***value*- Specifies the significance level or size of the test. This is the limit you place on the probability of a type 1 error. The specified value should be between 0 and 1. The default value is 0.05 which sets the probability of a type 1 error at 0.05.

Either the pair n1= and n2= or the pair nmin= and nmax= must be specified, but not both.

**n1=***value*- Specifies the sample size of group 1.
**n2=***value*- Specifies the sample size of group 2.
**nmin=***value*- Specifies the minimum total sample size at which power will be computed.
**nmax=***value*- Specifies the maximum total sample size at which power will be computed.

*DETAILS:*- See this discussion on power analysis for 2x2 tables for more details.
Hypotheses in the test are:

- H
_{0}: p_{1}= p_{2}

- H
_{A}: p_{1}≠ p_{2}

where p

_{1}and p_{2}are the success probabilities in the two populations. The Pearson chi-square statistic tests the null hypothesis (H_{0}) against the alternative hypothesis (H_{A}) and is available in the FREQ procedure when the CHISQ option is specified in the TABLES statement.The power is the probability of rejecting H

_{0}and is a function of the true difference in proportions. It is useful to explore the power that results assuming several different settings of the true probabilities. The type 2 error rate (denoted β) is the probability of accepting H_{0}for some nonzero true difference and is equal to 1-power. The power and β are computed for a range of total sample sizes at a particular alternative hypothesis that you specify. - H
*SEE ALSO:*-
- Discussion of power analysis for 2x2 tables
- %POWERRxC macro to compute power for Pearson and Likelihood Ratio chi-square tests of independence in PROC FREQ. Handles any number of rows and columns in a two-way table.
- %POWER macro to calculate power-related measures for retrospective and prospective analyses for linear models fit to normal responses.

*REFERENCES:*-
Agresti, A. (1990 and 2002),
*Categorical Data Analysis*, New York: John Wiley & Sons, Inc.

These sample files and code examples are provided by SAS Institute Inc. "as is" without warranty of any kind, either express or implied, including but not limited to the implied warranties of merchantability and fitness for a particular purpose. Recipients acknowledge and agree that SAS Institute shall not be liable for any damages whatsoever arising out of their use of this material. In addition, SAS Institute will provide no support for the materials contained herein.

These sample files and code examples are provided by SAS Institute Inc. "as is" without warranty of any kind, either express or implied, including but not limited to the implied warranties of merchantability and fitness for a particular purpose. Recipients acknowledge and agree that SAS Institute shall not be liable for any damages whatsoever arising out of their use of this material. In addition, SAS Institute will provide no support for the materials contained herein.

Right-click on the link below and select **Save** to save
the %POWER2x2 macro definition
to a file. It is recommended that you name the file
`power2x2.sas`

.

Download and save power2x2.sas

Computes the power of a test comparing two independent proportions using the Pearson chi-square statistic. Power is given for various sizes of the total sample, allowing you to pick the sample size that achieves the desired power.

#### Operating System and Release Information

Type: | Sample |

Topic: | SAS Reference ==> Procedures ==> FREQ Analytics ==> Nonparametric Analysis Analytics ==> Longitudinal Analysis Analytics ==> Descriptive Statistics Analytics ==> Exact Methods Analytics ==> Categorical Data Analysis |

Date Modified: | 2007-08-14 03:03:07 |

Date Created: | 2005-01-13 15:03:35 |

Product Family | Product | Host | SAS Release | |

Starting | Ending | |||

SAS System | SAS/STAT | All | n/a | n/a |