The FREQ Procedure

# EXACT Statement

Requests exact tests or confidence limits for the specified statistics. Optionally requests Monte Carlo estimates of the exact p-values.

 Requirements: TABLES statement Main discussion: Exact Statistics Featured in: Analyzing a 2×2 Contingency Table

 EXACT statistic-keyword(s) ;
statistic-keyword(s)
specifies the statistics for which to provide exact tests or confidence limits. PROC FREQ can compute exact p-values for the following hypothesis tests: chi-square goodness-of-fit for one-way tables; Pearson chi-square, likelihood-ratio chi-square, Mantel-Haenszel chi-square, Fisher's exact test, Jonckheere-Terpstra test, Cochran-Armitage test for trend, and McNemar's test for two-way tables. PROC FREQ can also compute exact p-values for tests of hypotheses that the following statistics are equal to zero: Pearson correlation coefficient, Spearman correlation coefficient, simple kappa coefficient, and weighted kappa coefficient. PROC FREQ can compute exact p-values for the binomial proportion test, as well as exact confidence limits for the binomial proportion. Additionally, PROC FREQ can compute exact confidence limits for odds ratios for 2×2 tables.

The statistic keywords are identical to options in the TABLES statement and keywords in the OUTPUT statement. You can request exact computations for groups of statistics by using keywords that are identical to the following TABLES statement options: CHISQ, MEASURES, and AGREE. For example, when you specify CHISQ in the EXACT statement, PROC FREQ computes exact p-values for the available CHISQ statistics (Pearson chi-square, likelihood-ratio chi-square, and Mantel-Haenszel chi-square). You request exact p-values for an individual statistic by specifying a keyword shown in EXACT Statement Statistic-keywords and Required TABLES Statement Options .

Note:   PROC FREQ computes exact tests by using fast and efficient algorithms that are superior to direct enumeration. This technique is appropriate when a data set is small, sparse, skewed, or heavily tied. For some large problems, exact computations may require a large amount of time or memory. Consider using the asymptotic tests for such problems. Alternatively, when asymptotic methods may not be sufficient for such large problems, consider using Monte Carlo estimation of exact p-values. See Exact Statistics for more information.

EXACT Statement Statistic-keywords and Required TABLES Statement Options
Keyword Exact statistics computed Required TABLES statement option
AGREE McNemar's test for 2×2 tables and tests for the simple kappa coefficient and the weighted kappa coefficient AGREE
BINOMIAL binomial proportion test for one-way tables BINOMIAL
CHISQ chi-square goodness-of-fit test for one-way tables; Pearson chi-square, likelihood-ratio chi-square, and Mantel-Haenszel chi-square tests for two-way tables ALL, CHISQ
FISHER Fisher's exact test ALL*, CHISQ*
JT Jonckheere-Terpstra test JT
KAPPA test for the simple kappa coefficient AGREE
LRCHI likelihood-ratio chi-square test ALL, CHISQ
MCNEM McNemar's test for 2×2 tables AGREE
MEASURES tests for the Pearson correlation coefficient and the Spearman correlation and the odds ratio confidence limits for 2×2 tables ALL, MEASURES
MHCHI Mantel-Haenszel chi-square test ALL, CHISQ
OR odds ratio confidence limits for 2×2 tables ALL, MEASURES, RELRISK
PCHI chi-square goodness-of-fit test for one-way tables, Pearson chi-square test for 2×2 tables ALL, CHISQ
PCORR test for the Pearson correlation coefficient ALL, MEASURES
SCORR test for the Spearman correlation coefficient ALL, MEASURES
TREND Cochran-Armitage test for trend TREND
WTKAP test for the weighted kappa coefficient AGREE
* ALL and CHISQ compute Fisher's exact test only for 2×2 tables.

ALPHA=p
specifies the confidence level for the confidence limits for the Monte Carlo p-value estimates. A confidence level of p results in (1-p)×100 percent confidence limits. Using ALPHA=.01 results in 99 percent confidence limits. If p is between 0 and 1 but is outside the range, PROC FREQ uses the closest range endpoint. For example, if p= 0.000001, PROC FREQ uses 0.0001 to determine confidence limits.
 Default: 0.01 Range: 0.000<=p<=0.0001 Interaction: ALPHA= invokes the MC option.

MAXTIME=value
specifies the maximum clock time (in seconds) that PROC FREQ uses to compute an exact p-value directly or with Monte Carlo estimation. If the procedure does not complete the computation within the specified time, the computation terminates.
 Range: a positive number See also: Computational Resources Featured in: Computing the Cochran-Armitage Trend Test

MC
requests Monte Carlo estimation of exact p-values, instead of direct exact p-value computation. Monte Carlo estimation can be useful for large problems that require a large amount of time and memory for exact computations, but for which asymptotic approximations may not be sufficient.
 Restriction: The MC option is available for all statistic keywords except BINOMIAL, MCNEM, and OR. PROC FREQ computes only exact tests or confidence limits for those statistics. Tip: If the procedure does not complete the computation within the specified time, use MAXTIME= to increase the amount of clock time that PROC FREQ uses to compute the exact p-values. Interaction: ALPHA=, N=, and SEED= automatically invoke the MC option. Tip: If the procedure does not complete the computation within the specified time, use MAXTIME= to increase the amount of clock time PROC FREQ can use to compute the Monte Carlo estimates. Main Discussion: Monte Carlo Estimation

N=n
specifies the number of samples for Monte Carlo estimation.
 Default: 10000 Range: a positive integer Interaction: N= invokes the MC option. Tip: Larger values of N= produce more precise estimates of exact p-values. Because larger values of N= generate more samples, the computation time increases. If you need more computation time, use MAXTIME= to increase the clock time.

SEED=n
specifies the initial seed for random number generation for Monte Carlo estimation.
 Default: the time of day from the computer's clock Range: a positive integer Interaction: SEED= invokes the MC option.

EXACT Statement Statistic-keywords and Required TABLES Statement Options lists the available statistic keywords and the exact statistics that are computed. If you use only one TABLES statement, you do not need to specify options in the TABLES statement to compute the statistics that the EXACT statement requests. PROC FREQ automatically invokes the corresponding TABLES statement option when you request exact computations. However, when you use multiple TABLES statements, and you want exact computations, you must specify options in the TABLES statement to compute the desired statistics. Then PROC FREQ performs exact computations for all statistics that are also specified in the EXACT statement.