12.4 - Changing the Table Format

When three or more variables are specified, the multiple levels of n-way tables can produce lots of output. Such bulky and complex crosstabulations are often easier to read as a continuous list. To tell SAS to generate list output for crosstabulations rather than the default tables, simply use the LIST tables option.

Example 12.10 Section

The following FREQ procedure illustrates the LIST option:

PROC FREQ data=icdb.back;
    title 'Crosstabulation of SEX and RACE: In List Format';
    tables sex*race/list;
 RUN;

Crosstabulation of SEX and RACE: in List Format
The FREQ Procedure

sex

race

Frequency

Percent

Cumulative Frequency

Cumulative Percent

1

2

3

0.47

3

0.47

1

3

1

0.16

4

0.63

1

4

51

7.99

55

8.62

1

7

1

0.16

56

8.78

2

1

2

0.31

58

9.09

2

2

4

0.63

62

9.72

2

3

28

4.39

90

14.11

2

4

542

84.95

632

99.06

2

5

3

0.47

635

99.53

2

6

2

0.31

637

99.84

2

8

1

0.16

638

100.00

Launch and run  the SAS program. Review the output to convince yourself that rather than creating a two-way table, SAS prints the requested two-way table as a list. I tend to prefer the LIST format for such cross-tabulations, as long as I'm not in need of the (conditional) row and column percentages (which, as you can see, are not reported in LIST format).

Incidentally, the LIST option cannot be used when the TABLES statement requests statistical tests or measures of association to be included in the output. (We'll be discussing such tests and measures later in this lesson.) Also, expected cell frequencies are not printed when the LIST option is specified, even if the EXPECTED option is invoked.

An alternative to the LIST option is the CROSSLIST table option. When you add the CROSSLIST option to your TABLES statement, SAS displays crosstabulation tables in the standard Output Delivery System (ODS) column format. The benefit of doing so probably won't make much sense until we learn about ODS in Stat 481. The option creates a table that has a table definition that you can customize by using the TEMPLATE procedure. For now, let's just be satisfied with looking at an example to see what the output looks like when you use the CROSSLIST option.

Example 12.11 Section

The following FREQ procedure illustrates the CROSSLIST option:

 PROC FREQ data=icdb.back;
    title 'Crosstabulation of SEX and RACE: In Crosslist Format';
    tables sex*race/crosslist;
 RUN;

Crosstabulation of SEX and RACE: In Crosslist Format
The FREQ Procedure

Table of sex by race

sex

race

Frequency

Percent

Row
Percent

Column
Percent

1

1

0

0.00

0.00

0.00

 

2

3

0.47

5.36

42.86

 

3

1

0.16

1.79

3.45

 

4

51

7.99

91.07

8.60

 

5

0

0.00

0.00

0.00

 

6

0

0.00

0.00

0.00

 

7

1

0.16

1.79

100.00

 

8

0

0.00

0.00

0.00

 

Total

56

8.78

100.00

 

2

1

2

0.31

0.34

100.00

 

2

4

0.63

0.69

57.14

 

3

28

4.39

4.81

96.55

 

4

542

84.95

93.13

91.40

 

5

3

0.47

0.52

100.00

 

6

2

0.31

0.34

100.00

 

7

0

0.00

0.00

0.00

 

8

1

0.16

0.17

100.00

 

Total

582

91.22

100.00

 

Total

1

2

0.31

 

100.00

 

2

7

1.10

 

100.00

 

3

29

4.55

 

100.00

 

4

593

92.95

 

100.00

 

5

3

0.47

 

100.00

 

6

2

0.31

 

100.00

 

7

1

0.16

 

100.00

 

8

1

0.16

 

100.00

 

Total

638

100.00

  

Launch and run  the SAS program, and review the output to familiarize yourself with the appearance of the output when you use the CROSSLIST option.