|
Chapter Contents |
Previous |
Next |
| The FREQ Procedure |
The TABLES statement requests one-way to n-way frequency and crosstabulation tables and the statistics for those tables.
If you omit the TABLES statement, PROC FREQ generates one-way frequency tables for all data set variables that are not listed in the other statements. The following argument is required in the TABLES statement.
For two-way to multiway tables, the values of the last variable form the crosstabulation table columns, while the values of the next-to-last variable form the rows. Each level (or combination of levels) of the other variables forms one stratum. PROC FREQ produces a separate crosstabulation table for each stratum. For example, a specification of A*B*C*D in a TABLES statement produces k tables, where k is the number of different combinations of values for A and B. Each table lists the values for C down the side and the values for D across the top.
You can use multiple TABLES statements in the PROC FREQ step. PROC FREQ builds all the table requests in one pass of the data, so that there is essentially no loss of efficiency. You can also specify any number of table requests in a single TABLES statement. To specify multiple table requests quickly, use a grouping syntax by placing parentheses around several variables and joining other variables or variable combinations. For example, the following statements illustrate grouping syntax.
Table 26.8: Grouping Syntax| Request | Equivalent to |
| tables A*(B C); | tables A*B A*C; |
| tables (A B)*(C D); | tables A*C B*C A*D B*D; |
| tables (A B C)*D; | tables A*D B*D C*D; |
| tables A -C; | tables A B C; |
| tables (A -C)*D; | tables A*D B*D C*D; |
The following table lists the options available with the TABLES statement. Descriptions follow in alphabetical order.
Table 26.9: TABLES Statement Options| Option | Description |
| Control Statistical Analysis | |
| AGREE | requests tests and measures of classification agreement |
| ALL | requests tests and measures of association produced by CHISQ, MEASURES, and CMH |
| ALPHA= | sets the confidence level for confidence bounds |
| BINOMIAL | requests binomial proportion, confidence bounds and test for one-way tables |
| CHISQ | requests chi-square tests and measures of association based on chi-square |
| CL | requests confidence limits for the MEASURES statistics |
| CMH | requests all Cochran-Mantel-Haenszel statistics |
| CMH1 | requests the CMH correlation statistic, and adjusted relative risks and odds ratios |
| CMH2 | requests CMH correlation and row mean scores (ANOVA) statistics, and adjusted relative risks and odds ratios |
| CONVERGE= | specifies convergence criterion to compute polychoric correlation |
| FISHER | requests Fisher's exact test for tables larger than 2 ×2 |
| JT | requests Jonckheere-Terpstra test |
| MAXITER= | specifies maximum number of iterations to compute polychoric correlation |
| MEASURES | requests measures of association and their asymptotic standard errors |
| MISSING | treats missing values as nonmissing |
| PLCORR | requests polychoric correlation |
| RELRISK | requests relative risk measures for 2 ×2 tables |
| RISKDIFF | requests risks and risk differences for 2 ×2 tables |
| SCORES= | specifies the type of row and column scores |
| TESTF= | specifies expected frequencies for a one-way table chi-square test |
| TESTP= | specifies expected proportions for a one-way table chi-square test |
| TREND | requests Cochran-Armitage test for trend |
| Control Additional Table Information | |
| CELLCHI2 | displays each cell's contribution to the total Pearson chi-square statistic |
| CUMCOL | displays the cumulative column percentage in each cell |
| DEVIATION | displays the deviation of the cell frequency from the expected value for each cell |
| EXPECTED | displays the expected cell frequency for each cell |
| MISSPRINT | displays missing value frequencies |
| SPARSE | lists all possible combinations of variable levels even when a combination does not occur |
| TOTPCT | displays percentage of total frequency on n-way tables when n>2 |
| Control Displayed Output | |
| NOCOL | suppresses display of the column percentage for each cell |
| NOCUM | suppresses display of cumulative frequencies and cumulative percentages in one-way frequency tables and in list format |
| NOFREQ | suppresses display of the frequency count for each cell |
| NOPERCENT | suppresses display of the percentage, row percentage, and column percentage in crosstabulation tables, or percentages and cumulative percentages in one-way frequency tables and in list format |
| NOPRINT | suppresses display of tables but displays statistics |
| NOROW | suppresses display of the row percentage for each cell |
| LIST | displays two-way to n-way tables in list format |
| PRINTKWT | displays kappa coefficient weights |
| SCOROUT | displays the row and the column scores |
| Create an Output Data Set | |
| OUT= | specifies an output data set to contain variable values and frequency counts |
| OUTEXPECT | includes the expected frequency of each cell in the output data set |
| OUTPCT | includes the percentage of column frequency, row frequency, and two-way table frequency in the output data set |
You can specify the following options in a TABLES statement.
The (WT=FC) specification requests that PROC FREQ use Fleiss-Cohen weights to compute the weighted kappa coefficient. By default, PROC FREQ uses Cicchetti-Allison weights. See the section "Weighted Kappa Coefficient" for more information. You can specify the option PRINTKWT to display the kappa coefficient weights.
The CELLCHI2 option is valid for contingency tables but has no effect on tables that are produced with the LIST option.
See the section "Chi-Square Tests and Statistics" for more information.
If you omit the CHISQ option in the TABLES statement, the FISHER option invokes CHISQ. You can also request Fisher's exact test by specifying the FISHER option in the EXACT statement.
Caution: For tables with many rows or columns or with large total frequency, PROC FREQ may require a large amount of time or memory to compute exact p-values (see the section "Computational Resources").
For more information, see the section "Output Data Sets".
By default, the row or column scores are the integers 1,2,... for character variables and the actual variable values for numeric variables. Using other types of scores yields nonparametric analyses. For more information, see the section "Scores".
|
Chapter Contents |
Previous |
Next |
Top |
Copyright © 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.