# 12.3 - Cell Statistics

12.3 - Cell Statistics

As you now know, when SAS creates two-way tables, each cell of the table contains, by default, the cell frequency, the (joint) cell percentage, the conditional row percentage, and the conditional column percentage. As usual, you don't have to accept the default ... you can tell SAS to suppress some of the default statistics it displays ... or you can tell SAS to display alternative statistics.

For n-way crosstabulations, you can suppress the default output in each of the cells by using any (or all) of the following table options:

• NOFREQ suppresses the printing of the cell freqencies
• NOROW suppresses the printing of the row percentages
• NOCOL suppresses the printing of the column percentages, and
• NOPERCENT suppresses the printing of the (joint) cell percentages

## Example 12.8

The following SAS program illustrates the NOROW, NOCOL, and NOPERCENT table options:

 PROC FREQ data=icdb.back;
title 'Crosstabulation of SEX and RACE: No percents';
tables race*sex/norow nocol nopercent;
RUN;
##### Table of race by sex
race sex
Frequency 1 2 Total
1 0 0 2
2 2 3 7
3 1 28 29
4 51 542 593
5 0 3 3
6 0 2 2
7 1 0 1
8 0 1 1
Total 56 582 638

Launch and run the SAS program. Review the output to convince yourself that SAS did indeed suppress the default row percentages, column percentages, and cell percentages. Note, too, that SAS changed the guide in the upper left-hand corner of the table to reflect the new situation — the guide now tells us that the lone number reported in each cell is the cell frequency.

Instead of suppressing output in an n-way table, we can request additional output in each of the cells by using the following options:

• EXPECTED, to print the expected cell frequencies under the null hypothesis of independence
• DEVIATION, to print the deviation of the cell frequency from the expected cell frequency (under the null hypothesis of independence)
• CELLCHI2, to print each cell's contribution to the total chi-squared statistic

That is, CELLCHI2 is defined as:

$$\text{CELLCHI2} = \dfrac{\left(\text{frequency} - \text{expected}\right)^2}{\text{expected}}$$

## Example 12.9

In creating the two-way table between race and sex, the following FREQ procedure requests that the EXPECTED and CELLCHI2 statistics be printed, while at the same time suppressing the printing of the joint, row, and column percentages:

 PROC FREQ data=icdb.back;
title 'Crosstabulation of SEX and RACE: With Expecteds';
tables race*sex/expected cellchi2 norow nocol nopercent;
RUN;
##### Table of race by sex
race sex
Frequency
Expected
Cell Chi-Square 1 2 Total
1 0 2 2
0.1755 1.8245
0.1755 0.0169
2 3 4 7
0.6144 6.3856
9.2624 0.8912
3 1 28 29
2.5455 26.455
0.9383 0.0903
4 51 542 593
52.05 540.95
0.0212 0.002
5 0 3 3
0.2633 2.7367
0.2633 0.0253
6 0 2 2
0.1755 1.8245
0.1755 0.0169
7 0 2 2
0.0878 0.9122
9.4806 09.122
8 0 1 1
0.0878 0.9122
0.0878 0.0084
Total 56 582 638

Launch and run the SAS program. Review the output to convince yourself that SAS did indeed suppress the printing of the joint, row, and column percentages, while adding the expected cell frequencies, as well as the cell's contribution to the chi-square statistic, to the cell output. Note, again, that SAS changed the guide in the upper left-hand corner of the table to reflect the new situation — the guide now tells us that the second number in each cell is the expected cell frequency and the third number is the cell's contribution to the chi-square statistic.

 [1] Link ↥ Has Tooltip/Popover Toggleable Visibility