TEMPLATE Procedure: Creating Crosstabulation Table Templates |
Using the TEMPLATE Procedure to Create a Customized Crosstabulation Table |
The TEMPLATE procedure enables you to customize the appearance of crosstabulation (contingency) tables that are created with the FREQ procedure.
By default, crosstabulation tables are formatted according to the CrossTabFreqs template that SAS provides. However, you can create a customized CrossTabFreqs table template by using the TEMPLATE procedure with the statements in the following table.
Task | Statement |
---|---|
Create a crosstabulation table template | DEFINE CROSSTABS |
Define a value that appears in the crosstabulation cells | DEFINE CELLVALUE |
Specify the order in which the cellvalues are stacked in the cells | CELLVALUE |
Create a template for a footer | DEFINE FOOTER |
Create a template for a header | DEFINE HEADER |
End a crosstabulation table template | END |
What Can You Do with a Crosstabulation Template? |
The CrossTabFreqs crosstabulation template describes how to display PROC FREQ's crosstabulation table. You can create a customized CrossTabFreqs crosstabulation template to do the following:
use custom formats for cellvalues
specify a style for each value in a cell
change the stacking order of values in a cell
change and style headers and footers
use variable labels in headers and footers
style table regions independently
change or remove the legend
Crosstabulation Table Created with Default Crosstabulation Table Template
The following display shows PROC FREQ output that has been created with a modified CrossTabFreqs template:
Crosstabulation Table Created with Modified Crosstabulation Table Template
The following are some of the customizations that were made to the crosstabulation table above:The legend text has been italicized and made smaller than the rest of the header text.
The header text now uses the variable label "Gender of Patient" instead of the variable name.
Row variable labels and column variable labels are used now instead of row variable names and column variable names.
The background color of the non-summary rows alternates.
The values in the grand total cell are now bold and italic.
The Deviation cellvalues are now red when the deviation exceeds abs (2.0).
The TotalPercent cellvalue has been moved from the middle of the other cellvalues to the bottom of the cellvalues.
Copyright © 2008 by SAS Institute Inc., Cary, NC, USA. All rights reserved.