Compute statistics on analysis variables by categories defined by the combinations of classification variables in a data set. Nest some of the categories under each other in the same dimension of the report so that the report has a hierarchical appearance.
Regional Gender Distribution among Job Classes -------------------------------------------------- -------------------------- |Job Class | Region | | |------------------------------ -------------------------| | | North | South | | |---------------------------+-- -------------------------| | | Female | Male | Female | Male | | |-------------+-------------+-- -----------+-------------| | |Count| % |Count| % |Count| % |Count| % | |------------------+-----+-------+-----+-------+-- ---+-------+-----+-------| |Technical | 7| 50.0| 7| 50.0| 3| 75.0| 1| 25.0| |Manager/Supervisor| 7| 58.3| 5| 41.7| 6| 100.0| 0| 0| |Clerical | 7| 70.0| 3| 30.0| 2| 28.6| 5| 71.4| |Administrative | 0| 0| 6| 100.0| 6| 54.5| 5| 45.5| |All Employees | 21| 50.0| 21| 50.0| 17| 60.7| 11| 39.3| -------------------------------------------------- -------------------------- -------------------------------------------------- -------------------------- |Job Class | Region | | |------------------------------ -------------------------| | | East | West | | |---------------------------+-- -------------------------| | | Female | Male | Female | Male | | |-------------+-------------+-- -----------+-------------| | |Count| % |Count| % |Count| % |Count| % | |------------------+-----+-------+-----+-------+-- ---+-------+-----+-------| |Technical | 5| 50.0| 5| 50.0| 1| 16.7| 5| 83.3| |Manager/Supervisor| 7| 50.0| 7| 50.0| 0| 0| 3| 100.0| |Clerical | 4| 66.7| 2| 33.3| 1| 20.0| 4| 80.0| |Administrative | 5| 62.5| 3| 37.5| 0| 0| 1| 100.0| |All Employees | 21| 55.3| 17| 44.7| 2| 13.3| 13| 86.7| -------------------------------------------------- -------------------------- ------------------------------------------------ |Job Class | All Regions Combined | | |---------------------------| | | Female | Male | | |-------------+-------------| | |Count| % |Count| % | |------------------+-----+-------+-----+-------| |Technical | 16| 47.1| 18| 52.9| |Manager/Supervisor| 20| 57.1| 15| 42.9| |Clerical | 14| 50.0| 14| 50.0| |Administrative | 11| 42.3| 15| 57.7| |All Employees | 61| 49.6| 62| 50.4| ------------------------------------------------ |
Data Set | JOBCLASS |
Featured Step | PROC TABULATE |
Featured Step Statements and Options | TABLE statement: PCTN statistic with denominator definition |
Formatting Features | PROC TABULATE statement: FORMAT= option
PROC TABULATE statement: NOSEPS option when sending output to the LISTING destination TABLE statement: BOX=, MISSTEXT=, and NOCONTINUED options TABLE statement: CONDENSE and RTS= options when sending output to the LISTING destination |
ODS Enhanced Versions of This Example | Examples 6.3 and 6.7 |
Other Examples That Use This Data Set | Examples 3.4, 3.6, 6.3, and 6.7 |
Hierarchical tables define table cells that represent multiple class variables in the same dimension (row, column, or page). This example first presents the frequencies and percentages for each gender within each region and job class and for each gender and job class. The latter part of the report removes the top level of the hierarchy, which is the region. It summarizes the frequencies and percentages over all regions for each category defined by the combinations of the values of GENDER and JOBCLASS.
This example differs from Example 3.4 by adding REGION as a classification variable.
Each observation in JOBCLASS corresponds to the information for one employee.
Define formats to associate with the classification variables. | proc format; value gendfmt 1='Female' 2='Male'; value occupfmt 1='Technical' 2='Manager/Supervisor' 3='Clerical' 4='Administrative'; value regfmt 1='North' 2='South' 3='East' 4='West'; run; proc tabulate data=jobclass |
Specify a default format for each cell in the table. | format=5. |
Eliminate horizontal separator lines from the row titles and the body of the table when sending output to the LISTING destination. | noseps; |
title 'Regional Gender Distribution'; title2 'among Job Classes'; | |
Identify the classification variables whose values define the categories for which PROC TABULATE calculates statistics. | class gender region occupat; |
Specify the row dimension. | table occupat=' ' |
Add a summary row at the bottom of the report. | all='All Employees', |
Specify the column dimension. Place REGION and the universal CLASS variable ALL side-by-side at the top of the hierarchy. | (region='Region' all='All Regions Combined')* |
Place GENDER next in the hierarchy. Do not label GENDER. | gender=' '* |
Place the statistics, N and PCTN, at the bottom of the hierarchy. Specify GENDER as the denominator of the percentage calculation. Cells formed by the combinations of the values of REGION, GENDER, and OCCUPAT use as the denominator the sum of the frequency counts for GENDER within each combination of REGION and OCCUPAT. Cells formed by the combinations of the values of GENDER and OCCUPAT use as the denominator the sum of the frequency counts for GENDER for each value of OCCUPAT. (See “Interpreting Denominator Definitions” on page 100 for more information on using denominator definitions.) | (n='Count' pctn<gender>='%'*f=7.1) |
When sending output to the LISTING destination, specify the space allocated to row titles. | / rts=20 |
Since the report is wide and not long, print as many tables as possible on one page instead of starting each table on a new page when sending output to the LISTING destination. | condense |
Suppress the continuation message for tables that span multiple physical pages. | nocontinued |
Specify the text to print in cells that contain missing values. | misstext='0' |
Specify the text to place in the empty box above the row titles. | box='Job Class'; |
format gender gendfmt. occupat occupfmt. region regfmt.; run; |
PROC TABULATE reference, usage information, and additional examples. See “The TABULATE Procedure,” in the “Procedures” section of Base SAS 9.1 Procedures Guide.
13.59.237.58