SUPPORT / SAMPLES & SAS NOTES
 

Support

Sample 25013: Power and sample size for independence tests in RxC tables

DetailsResultsDownloadsAboutRate It

Power and sample size for independence tests in RxC tables

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

NOTE: Beginning in SAS 9.4 TS1M4, use the CUSTOM statement in SAS/STAT PROC POWER to do these power computations.
PURPOSE:
Computes approximate power for Pearson and Likelihood Ratio chi-square tests of independence in PROC FREQ.
REQUIREMENTS:
Only Base SAS Software is required.
USAGE:
Follow the instructions in the Downloads tab of this sample to save the POWERRxC macro definition. Replace the text within quotes in the following statement with the location of the POWERRxC macro definition file on your system. In your SAS program or in the SAS editor window, specify this statement to define the POWERRxC macro and make it available for use:
   %inc "<location of your file containing the POWERRxC macro>";

Following this statement, you may call the POWERRxC macro. See the Results tab for an example.

The following parameters are required:

row=variable
Specifies the variable defining the rows of the table.
col=variable
Specifies the variable defining the columns of the table.

These parameters are optional:

data=data-set-name
Specifies the SAS data set to be analyzed. If the DATA= option is not supplied, the most recently created SAS data set is used.
count=variable
Specifies a variable containing the cell counts of the table. Omit this option if each observation in the DATA= data set represents only a single entry in the table. This variable, if specified, is used in the WEIGHT statement in PROC FREQ.
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.
nrange=value | value-list
Specifies the sample size or list of sample sizes for which approximate power is to be computed. If omitted, the actual sample size is used. You may specify a list of values separated by commas, a range of the form x TO y or x TO y BY z, or a combination of these. However, you must surround the NRANGE= value with %str( ) if any commas appear in it. For example,
nrange=20 to 200 by 20
nrange=%str(20,50,100,140)
nrange=%str(10, 20, 50 to 100 by 10)
DETAILS:
Agresti (1990 and 2002) discusses the details of computing approximate power for Pearson and deviance chi-square tests in contingency tables using the noncentral chi-square distribution.
LIMITATIONS:
Limited error checking is done. If the DATA= option is specified, be sure the named data set exists. If DATA= is not specified, a data set must have been created previously in the current SAS session. Be sure that the variables specified in the ROW=, COL= and COUNT= options exist in the data set. You can run PROC CONTENTS on the data set prior to using this macro to verify the data set name and the names of variables.
SEE ALSO:
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.