The TABULATE Procedure |
Requirement: | All variables in the TABLE statement must appear in either the VAR statement or the CLASS statement. |
Tip: | To create several tables use multiple TABLE statements. |
Tip: | Use of variable name list shortcuts is now supported within the TABLE statement. For more information, refer to Shortcuts for Specifying Lists of Variable Names. |
TABLE <<page-expression,> row-expression,>
column-expression </ table-option(s)>; |
Required Arguments |
defines the columns in the table. For information about constructing dimension expressions, see Constructing Dimension Expressions.
Restriction: | A column dimension is the last dimension in a TABLE statement. A row dimension or a row dimension and a page dimension can precede a column dimension. |
Options |
Task | Option | |
---|---|---|
Add dimensions |
|
|
Define the pages in a table |
page-expression |
|
|
Define the rows in a table |
row-expression |
Customize the HTML contents entry link to the output | CONTENTS=
|
|
Modify the appearance of the table | ||
|
Change the order of precedence for specified format modifiers | FORMAT_PRECEDENCE=
|
|
Specify a style element for various parts of the table | STYLE=
|
|
Change the order of precedence for specified style attribute values | STYLE_PRECEDENCE=
|
Customize text in the table | ||
|
Specify the text to place in the empty box above row titles | BOX=
|
Supply up to 256 characters to print in table cells that contain missing values | MISSTEXT=
|
|
|
Suppress the continuation message for tables that span multiple physical pages | NOCONTINUED
|
Modify the layout of the table | ||
Print as many complete logical pages as possible on a single printed page or, if possible, print multiple pages of tables that are too wide to fit on a page one below the other on a single page, instead of on separate pages. | CONDENSE
|
|
Create the same row and column headings for all logical pages of the table | PRINTMISS
|
|
Customize row headings | ||
Specify the number of spaces to indent nested row headings | INDENT=
|
|
Control allocation of space for row titles within the available space | ROW=
|
|
Specify the number of print positions available for row titles | RTSPACE=
|
specifies text and a style element for the empty box above the row titles.
Value can be one of the following:
writes the page-dimension text in the box. If the page-dimension text does not fit, then it is placed in its default position above the box, and the box remains empty.
writes the quoted string in the box. Any string that does not fit in the box is truncated.
writes the name (or label, if the variable has one) of a variable in the box. Any name or label that does not fit in the box is truncated.
For details about the arguments of the STYLE= option and how it is used, see STYLE= in the PROC TABULATE statement.
Featured in: | Creating Multipage Tables and Specifying Style Elements for ODS Output |
prints as many complete logical pages as possible on a single printed page or, if possible, prints multiple pages of tables that are too wide to fit on a page one below the other on a single page, instead of on separate pages. A logical page is all the rows and columns that fall within one of the following:
Restrictions: | CONDENSE has no effect on the pages that are generated by the BY statement. The first table for a BY group always begins on a new page. |
Featured in: | Creating Multipage Tables |
enables you to name the link in the HTML table of contents that points to the ODS output of the table that is produced by using the TABLE statement.
Note: CONTENTS= affects only the contents file of ODS HTML output. It has no effect on the actual TABULATE procedure reports.
specifies whether the format that is specified for the page dimension (PAGE), row dimension (ROW), or column dimension (COLUMN or COL) is applied to the contents of the table cells.
Default: | COLUMN |
supplies a numeric value against which analysis variable values and table cell values other than frequency counts are compared to eliminate trivial values (absolute values less than the FUZZ= value) from computation and printing. A number whose absolute value is less than the FUZZ= value is treated as zero in computations and printing. The default value is the smallest representable floating-point number on the computer that you are using.
specifies the number of spaces to indent nested row headings, and suppresses the row headings for class variables.
Tip: | When there are no crossings in the row dimension, there is nothing to indent, so the value of number-of-spaces has no effect. However, in such cases INDENT= still suppresses the row headings for class variables. |
Restriction: | In the HTML, RTF, and Printer destinations, the INDENT= option suppresses the row headings for class variables but does not indent nested row headings. |
Featured in: | Indenting Row Headings and Eliminating Horizontal Separators (with crossings) and Creating Multipage Tables (without crossings) |
supplies up to 256 characters of text to print and specifies a style element for table cells that contain missing values. For details about the arguments of the STYLE= option and how it is used, see STYLE= in the PROC TABULATE statement.
Interaction: | A style element that is specified in a dimension expression overrides a style element that is specified in the MISSTEXT= option for any given cells. |
Featured in: | Providing Text for Cells That Contain Missing Values and Specifying Style Elements for ODS Output |
suppresses the continuation message, continued , that is displayed at the bottom of tables that span multiple pages. The text is rendered with the Aftercaption style element.
Note: Because HTML browsers do not break pages, NOCONTINUED has no effect on the HTML destination.
defines the pages in a table. For information about constructing dimension expressions, see Constructing Dimension Expressions.
Restriction: | A page dimension is the first dimension in a table statement. Both a row dimension and a column dimension must follow a page dimension. |
Featured in: | Creating Multipage Tables |
prints all values that occur for a class variable each time headings for that variable are printed, even if there are no data for some of the cells that these headings create. Consequently, PRINTMISS creates row and column headings that are the same for all logical pages of the table, within a single BY group.
Default: | If you omit PRINTMISS, then PROC TABULATE suppresses a row or column for which there are no data, unless you use the CLASSDATA= option in the PROC TABULATE statement. |
Restrictions: | If an entire logical page contains only missing values, then that page does not print regardless of the PRINTMISS option. |
See also: | CLASSDATA= option |
Featured in: | Providing Headings for All Categories |
specifies whether all title elements in a row crossing are allotted space even when they are blank. The possible values for spacing are as follows:
allots space to all row titles even if the title has been blanked out. (For example, N=' '.)
Alias: | CONST |
divides the row title space equally among the nonblank row titles in the crossing.
Default: | CONSTANT |
Featured in: | Eliminating Row Headings |
defines the rows in the table. For information about constructing dimension expressions, see Constructing Dimension Expressions.
Restriction: | A row dimension is the next to last dimension in a table statement. A column dimension must follow a row dimension. A page dimension can precede a row dimension. |
specifies the number of print positions to allot to all of the headings in the row dimension, including spaces that are used to print outlining characters for the row headings. PROC TABULATE divides this space equally among all levels of row headings.
Alias: | RTS= |
Default: | one-fourth of the value of the SAS system option LINESIZE= |
Restriction: | The RTSPACE= option affects only the traditional SAS monospace output destination. |
Interaction: | By default, PROC TABULATE allots space to row titles that are blank. Use ROW=FLOAT in the TABLE statement to divide the space among only nonblank titles. |
See also: | For more information about controlling the space for row titles, see Chapter 5, "Controlling the Table's Appearance," in SAS Guide to TABULATE Processing. |
Featured in: | Creating a Basic Two-Dimensional Table |
specifies a style element to use for parts of the table other than table cells. See STYLE= in the PROC TABULATE statement for information about the style element arguments.
Note: You can use braces ({ and }) instead of square brackets ([ and ]).
The following table shows the attributes that you can set or change with the STYLE= option in the TABLE statement. Most of these attributes apply to parts of the table other than cells (for example, table borders and the lines between columns and rows). Attributes that you apply in the PROC TABULATE statement and in other locations in the PROC TABULATE step apply to cells within the table. Note that not all attributes are valid in all destinations. See Style Attributes and Their Values in SAS Output Delivery System: User's Guide for more information about these style attributes, their valid values, and their applicable destinations.
Attribute | PROC REPORT STATEMENT: REPORT Area | PROC REPORT Areas: CALLDEF, COLUMN, HEADER, LINES, SUMMARY | PROC TABULATE STATEMENT: TABLE | PROC TABULATE STATEMENTS: VAR, CLASS, BOX Opt, CLASSLEV, KEYWORD |
---|---|---|---|---|
ASIS= | X | X |
|
X |
BACKGOUNDCOLOR= | X | X | X | X |
BACKGOUNDIMAGE= | X | X | X | X |
BORDERBOTTOMCOLOR= | X | X |
|
X |
BORDERBOTTOMSTYLE= | X | X | X | X |
BORDERBOTTOMWIDTH= | X | X | X | X |
BORDERCOLOR= | X | X |
|
X |
BORDERCOLORDARK= | X | X | X | X |
BORDERCOLORLIGHT= | X | X | X | X |
BORDERTOPCOLOR= | X | X |
|
X |
BORDERTOPSTYLE= | X | X | X | X |
BORDERTOPWIDTH= | X | X | X | X |
BORDERWIDTH= | X | X | X | X |
CELLPADDING= | X |
|
X |
|
CELLSPACING= | X |
|
X |
|
CLASS= | X | X | X | X |
COLOR= | X | X | X |
|
FLYOVER= | X | X |
|
X |
FONT= | X | X | X | X |
FONTFAMILY= | X | X | X | X |
FONTSIZE= | X | X | X | X |
FONTSTYLE= | X | X | X | X |
FONTWEIGHT= | X | X | X | X |
FONTWIDTH= | X | X | X | X |
FRAME= | X |
|
X |
|
HEIGHT= | X | X |
|
X |
HREFTARGET= |
|
X |
|
X |
HTMLSTYLE= | X | X | X | X |
NOBREAKSPACE= | X | X |
|
X |
POSTHTML= | X | X | X | X |
POSTIMAGE= | X | X | X | X |
POSTTEXT= | X | X | X | X |
PREHTML= | X | X | X | X |
PREIMAGE= | X | X | X | X |
PRETEXT= | X | X | X | X |
PROTECTSPECIALCHARS= |
|
X |
|
X |
RULES= | X |
|
X |
|
TAGATTR= | X | X |
|
X |
TEXTALIGN= | X | X | X | X |
URL= |
|
X |
|
X |
VERTICALALIGN= |
|
X |
|
X |
WIDTH= | X | X | X | X |
Note: The list of attributes that you can set or change with the STYLE= option in the TABLE statement differs from the list of attributes of the PROC TABULATE statement.
Alias: | S= |
Restriction: | This option affects only the HTML, RTF, and Printer destinations. |
Tip: | To override a style element specification that is made as an option in the TABLE statement, specify STYLE= in a dimension expression of the TABLE statement. |
Featured in: | Specifying Style Elements for ODS Output |
specifies whether the style that is specified for the page dimension (PAGE), row dimension (ROW), or column dimension (COLUMN or COL) is applied to the contents of the table cells.
Default: | COLUMN |
Featured in: | Style Precedence |
Constructing Dimension Expressions |
A dimension expression defines the content and appearance of a dimension (the columns, rows, or pages in the table) by specifying the combination of variables, variable values, and statistics that make up that dimension. A TABLE statement consists of from one to three dimension expressions separated by commas. Options can follow the dimension expressions.
If all three dimensions are specified, then the leftmost dimension expression defines pages, the middle dimension expression defines rows, and the rightmost dimension expression defines columns. If two dimensions are specified, then the left dimension expression defines rows, and the right dimension expression defines columns. If a single dimension is specified, then the dimension expression defines columns.
A dimension expression consists of one or more elements and operators.
(See VAR Statement.)
(See CLASS Statement.)
summarizes all of the categories for class variables in the same parenthetical group or dimension (if the variable ALL is not contained in a parenthetical group).
Featured in: | Summarizing Information with the Universal Class Variable ALL, Creating Multipage Tables, and Using Denominator Definitions to Display Basic Frequency Counts and Percentages |
Note: If the input data set contains a variable named ALL, then enclose the name of the universal class variable in quotation marks.
See Statistics That Are Available in PROC TABULATE for a list of available statistics. Use the asterisk (*) operator to associate a statistic keyword with a variable. The N statistic (number of nonmissing values) can be specified in a dimension expression without associating it with a variable.
Default: | For analysis variables, the default statistic is SUM. Otherwise, the default statistic is N. |
Examples: |
n Region*n Sales*max |
Restriction: | Statistic keywords other than N must be associated with an analysis variable. |
Interaction: | Statistical keywords should be enclosed by single or double quotation marks to ensure that the keyword element is treated as a statistical keyword and not treated as a variable. By default, SAS treats these keywords as variables. |
Featured in: | Reporting on Multiple-Response Survey Data and Using Denominator Definitions to Display Basic Frequency Counts and Percentages |
define how to format values in cells. Use the asterisk (*) operator to associate a format modifier with the element (an analysis variable or a statistic) that produces the cells that you want to format. Format modifiers have the form
f=format
Example: |
Sales*f=dollar8.2 |
Tip: | Format modifiers have no effect on CLASS variables. |
See also: | For more information about specifying formats in tables, see Formatting Values in Tables. |
Featured in: | Summarizing Information with the Universal Class Variable ALL |
temporarily replace the names of variables and statistics. Labels affect only the variable or statistic that immediately precedes the label. Labels have the form
statistic-keyword-or-variable-name='label-text'
Tip: | PROC TABULATE eliminates the space for blank column headings from a table but by default does not eliminate the space for blank row headings unless all row headings are blank. Use ROW=FLOAT in the TABLE statement to remove the space for blank row headings. |
Examples: |
Region='Geographical Region' Sales*max='Largest Sale' |
Featured in: | Customizing Row and Column Headings and Eliminating Row Headings |
specify style elements for page dimension text, headings, or data cells. For details, see Specifying Style Elements in Dimension Expressions.
creates categories from the combination of values of the class variables and constructs the appropriate headings for the dimension. If one of the elements is an analysis variable, then the statistics for the analysis variable are calculated for the categories that are created by the class variables. This process is called crossing.
Examples: |
Region*Division Quarter*Sales*f=dollar8.2 |
Featured in: | Creating a Basic Two-Dimensional Table |
places the output for each element immediately after the output for the preceding element. This process is called concatenation.
Example: |
n Region*Sales ALL |
Featured in: | Summarizing Information with the Universal Class Variable ALL |
group elements and associate an operator with each concatenated element in the group.
Examples: |
Division*(Sales*max Sales*min) (Region ALL)*Sales |
Featured in: | Summarizing Information with the Universal Class Variable ALL |
specify denominator definitions, which determine the value of the denominator in the calculation of a percentage. For a discussion of how to construct denominator definitions, see Calculating Percentages.
Featured in: | Reporting on Multiple-Response Survey Data and Using Denominator Definitions to Display Basic Frequency Counts and Percentages |
You can specify a style element in a dimension expression to control the appearance in HTML, RTF, and Printer output of the following table elements:
The syntax for specifying a style element in a dimension expression is
[STYLE<(CLASSLEV)>=<style-element-name |
PARENT>[style-attribute-name=style-attribute-value<... style-attribute-name=style-attribute-value>]] |
Some examples of style elements in dimension expressions are
dept={label='Department' style=[color=red]}, N | |
dept*[style=MyDataStyle], N | |
dept*[format=12.2 style=MyDataStyle], N |
Note: When used in a dimension expression, the STYLE= option must be enclosed within square brackets ([ and ]) or braces ({ and }).
With the exception of (CLASSLEV), all arguments are described in STYLE= in the PROC TABULATE statement.
assigns a style element to a class variable level value heading. For example, the following TABLE statement specifies that the level value heading for the class variable, DEPT, has a foreground color of yellow:
table dept=[style(classlev)= [color=yellow]]*sales;
Note: This option is used only in dimension expressions.
For an example that shows how to specify style elements within dimension expressions, see Specifying Style Elements for ODS Output.
Copyright © 2010 by SAS Institute Inc., Cary, NC, USA. All rights reserved.