Chapter Contents |
Previous |
Next |
The FREQ Procedure |
Default: | 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. |
Featured in: | Creating an Output Data Set with Table Cell Frequencies |
TABLES request(s) </ option(s)>; |
Required Arguments |
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, the TABLES statement request A*B*C*D 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:
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; |
Without Options |
Options |
To do this | Use this option | |
---|---|---|
Control statistical analysis | ||
Request tests and measures of classification agreement | AGREE | |
Request tests and measures of association produced by CHISQ, MEASURES, and CMH | ALL | |
Set the confidence level for confidence limits | ALPHA= | |
Request binomial proportion, confidence limits, and test for one-way tables | BINOMIAL | |
Request chi-square tests and measures of association based on chi-square | CHISQ | |
Request confidence limits for the MEASURES statistics | CL | |
Request all Cochran-Mantel-Haenszel statistics, adjusted relative risks, and odds ratios | CMH | |
Request adjusted relative risks and odds ratios and CMH correlation statistic | CMH1 | |
Request adjusted relative risks and odds ratios, CMH correlation, and row mean scores (ANOVA) statistic | CMH2 | |
Specify convergence criterion to compute polychoric correlation | CONVERGE= | |
Request Fisher's exact test for tables larger than 2×2 | FISHER | |
Request Jonckheere-Terpstra test | JT | |
Specify maximum number of iterations to compute polychoric correlation | MAXITER= | |
Request measures of association and their asymptotic standard errors | MEASURES | |
Treat missing values as nonmissing | MISSING | |
Request polychoric correlation | PLCORR | |
Request relative risk measures for 2×2 tables | RELRISK | |
Request risks and risk differences for 2×2 tables | RISKDIFF | |
Specify the type of row and column scores | SCORES= | |
Specify expected frequencies for a one-way table chi-square test | TESTF= | |
Specify expected proportions for a one-way table chi-square test | TESTP= | |
Request Cochran-Armitage test for trend | TREND | |
Control additional table information | ||
Report each cell's contribution to the total Pearson chi-square statistic | CELLCHI2 | |
Display the cumulative column percentage in each cell | CUMCOL | |
Display the deviation of the cell frequency from the expected value for each cell | DEVIATION | |
Display the expected cell frequency for each cell | EXPECTED | |
Display missing value frequencies | MISSPRINT | |
List all possible combinations of variable levels even when a combination does not occur | SPARSE | |
Display percentage of total frequency on n-way tables when n>2 | TOTPCT | |
Control displayed output | ||
Suppress the column percentage for each cell | NOCOL | |
Suppress the cumulative frequencies and the cumulative percentages in one-way frequency tables and in list format | NOCUM | |
Suppress the frequency count for each cell | NOFREQ | |
Suppress the percentage, row percentage, and column percentage in crosstabulation tables, or percentages and cumulative percentages in one-way frequency tables and in list format | NOPERCENT | |
Suppress the display of tables but report the statistics | NOPRINT | |
Suppress the row percentage for each cell | NOROW | |
Display two-way to n-way tables in list format | LIST | |
Display the kappa coefficient weights | PRINTKWT | |
Display the row and the column scores | SCOROUT | |
Use a field 8 positions wide to display the cell frequencies between 1.E7 and 1.E8 | V5FMT | |
Create an output data set | ||
Specify an output data set to contain variable values and frequency counts | OUT= | |
Include the expected frequency of each cell in the output data set | OUTEXPECT | |
Include the percentage of column frequency, row frequency, and two-way table frequency in the output data set | OUTPCT |
CA | Cicchetti-Allison weights |
FC | Fleiss-Cohen weights |
Default: | CA |
Main discussion: | Weighted Kappa Coefficient |
Restriction: | The table must be square. |
Tip: | You can specify PRINTKWT to display the kappa coefficient weights. |
Main discussion: | Tests and Measures of Agreement |
Featured in: | Testing Marginal Homogeneity with Cochran's Q |
Interaction: | CMH1 and CMH2 control which CMH statistics PROC FREQ computes. |
Default: | 0.05 |
Range: | 0.0001<=p<=0.9999 |
Default: | P=0.5 |
Restriction: | for one-way tables |
Interaction: | To request an exact test for the binomial proportion, specify BINOMIAL in the EXACT statement. |
Main Discussion: | Binomial Proportion |
Featured in: | Computing Binomial Proportions for One-Way Frequency Tables |
Interaction: | CELLCHI2 is valid for contingency tables but has no effect on tables that are produced with LIST. |
Main discussion: | Chi-Square Tests and Measures |
Featured in: | Analyzing a 2×2 Contingency Table and Creating an Output Data Set Containing Chi-Square Statistics |
Interaction: | If you omit MEASURES, CL invokes MEASURES. |
Interaction: | PROC FREQ determines the confidence coefficient using ALPHA= , which by default equals 0.05 and produces 95 percent confidence limits. |
Main discussion: | Measures of Association |
Featured in: | Computing the Cochran-Armitage Trend Test |
Interaction: | CMH1 and CMH2 control the number of CMH statistics that PROC FREQ computes. |
Main discussion: | Cochran-Mantel-Haenszel Statistics |
Featured in: | Computing Cochran-Mantel-Haenszel Statistics for a Stratified Table |
Featured in: | Computing Friedman's Chi-Square Statistic |
Alias: | CONV= |
Default: | 0.0001 |
Range: | a positive number |
Main discussion: | Polychoric Correlation |
Interaction: | DEVIATION is valid for crosstabulation tables but has no effect on tables produced with LIST. |
Featured in: | Creating an Output Data Set Containing Chi-Square Statistics |
Interaction: | EXPECTED is valid for contingency tables but has no effect on tables produced with LIST. |
Featured in: | Creating an Output Data Set Containing Chi-Square Statistics |
Alias: | EXACT |
Interaction: | If you omit CHISQ, FISHER invokes CHISQ. |
Interaction: | ALL does not invoke this option. |
Main discussion: | Fisher's Exact Test |
Main discussion: | Jonckheere-Terpstra Test |
Restriction: | PROC FREQ ignores LIST when you request statistical tests or measures of association. |
Default: | 20 |
Range: | an integer between 0 and 32767 |
Main discussion: | Polychoric Correlation |
Interaction: | CL requests confidence limits. |
Main discussion: | Measures of Association |
Featured in: | Computing the Cochran-Armitage Trend Test |
Main discussion: | Missing Values |
Main discussion: | Missing Values |
Featured in: | Creating an Output Data Set Containing Chi-Square Statistics |
Featured in: | Computing Chi-Square Tests for One-Way Frequency Tables |
Featured in: | Computing Cochran-Mantel-Haenszel Statistics for a Stratified Table |
Featured in: | Creating an Output Data Set Containing Chi-Square Statistics |
Main discussion: | Output Data Sets |
See also: | OUTEXPECT and OUTPCT |
Featured in: | Creating an Output Data Set with Table Cell Frequencies |
Main discussion: | Output Data Sets |
Featured in: | Creating an Output Data Set with Table Cell Frequencies |
Main discussion: | Output Data Sets |
Interaction: | If you omit MEASURES, PLCORR invokes MEASURES. |
Main discussion: | Polychoric Correlation |
See also: | CONVERGE= and MAXITER= |
Interaction: | You must specify AGREE to compute the kappa coefficients. The WT= option controls how PROC FREQ computes the kappa coefficient weights. |
Main discussion: | Weighted Kappa Coefficient |
Main discussion: | Odds Ratio and Relative Risks for 2×2 Tables |
Featured in: | Analyzing a 2×2 Contingency Table |
Alias: | PDIFF, RDIFF |
Main discussion: | Risks and Risk Differences |
|
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.
Default: | TABLE |
Main discussion: | Scores |
Featured in: | Computing Friedman's Chi-Square Statistic |
Restriction: | SCOROUT displays the row and column scores only when statistics are computed for two-way tables. |
Tip: | To store the scores in an output data set, use the Output Delivery System. |
Main discussion: | Scores |
See also: | SCORES= |
See also: | Missing Values |
Featured in: | Creating an Output Data Set with Table Cell Frequencies |
Range: | The sum of the frequency values must equal the total frequency for the one-way table. |
Restriction: | The number of TESTF= values must equal the number of variable levels in the one-way table. List these values in the order that the corresponding variable levels appear in the output. |
Interaction: | If you omit CHISQ, TESTF= invokes CHISQ. |
Main discussion: | Chi-Square Test for One-Way Tables |
Range: | Specify values in probability form as numbers between 0 and 1, where the proportions sum to 1. Or, specify values in percentage form as numbers between 0 and 100, where the percentages sum to 100. |
Restriction: | The number of TESTP= values must equal the number of variable levels in the one-way table. List these values in the order that the corresponding variable levels appear in the output. |
Interaction: | If you omit CHISQ, TESTP= invokes CHISQ. |
Main discussion: | Chi-Square Test for One-Way Tables |
Featured in: | Computing Chi-Square Tests for One-Way Frequency Tables |
Restriction: | The table must be 2×c or r×2. |
Main discussion: | Cochran-Armitage Test for Trend |
Featured in: | Computing the Cochran-Armitage Trend Test |
Chapter Contents |
Previous |
Next |
Top of Page |
Copyright 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.