Chapter Contents

Previous

Next
The TABULATE Procedure

TABLE Statement


Describes a table to print.

Requirement: All variables in the TABLE statement must appear in either the VAR statement or the CLASS statement.
Tip: Use multiple TABLE statements to create several tables.


TABLE <<page-expression,> row-expression,>
column-expression </ table-option(s)>;


Required Arguments

column-expression
defines the columns in the table. For information on 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 may precede a column dimension.


Options

To do this Use this 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=
Specify a style element for various parts of the table STYLE=
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=

Suppresses 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=

BOX=value
BOX={<label=value> <style=<style-element-name><[style-attribute-specification(s)]>> }
specifies text and a style element for the empty box above the row titles.

Value can be one of the following:

_PAGE_
writes the page-dimension text in the box. If the page-dimension text does not fit, it is placed in its default position above the box, and the box remains empty.

'string'
writes the quoted string in the box. Any string that does not fit in the box is truncated.

variable
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 HTML Output

CONDENSE
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.

CONDENSE is ignored by the HTML destination but supported by the printer.

Featured in: Creating Multipage Tables

CONTENTS=link-name
allows 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.
Restrictions: CONTENTS= has no effect on TABULATE procedure reports.

FUZZ=number
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.

INDENT=number-of-spaces
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.
Featured in: Indenting Row Headings and Eliminating Horizontal Separators (with crossings) and Creating Multipage Tables (without crossings)

page-expression
defines the pages in a table. For information on 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

MISSTEXT='text'
MISSTEXT={<label= 'text' ><style=<style-element-name><[style-attribute-specification(s)]>> }
supplies up to 256 characters of text to print and specifies a style element for table cells that contain missing values. For details on 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 cell(s).
Featured in: Providing Text for Cells That Contain Missing Values and Specifying Style Elements for HTML Output

NOCONTINUED
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.
Restrictions: NOCONTINUED is ignored by the HTML destination but supported by the printer.

PRINTMISS
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, 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, that page does not print regardless of the PRINTMISS option.
See also: CLASSDATA= option
Featured in: Providing Headings for All Categories

ROW=spacing
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:

CONSTANT
allots space to all row titles even if the title has been blanked out (for example, N=' ').
Alias: CONST

FLOAT
divides the row title space equally among the nonblank row titles in the crossing.

Default: CONSTANT
Featured in: Eliminating Row Headings

row-expression
defines the rows in the table. For information on 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 may precede a row dimension.

RTSPACE=number
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=
Interaction: By default, PROC TABULATE allots space to row titles that are blank. Use ROW=FLOAT 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

STYLE=<style-element-name><[style-attribute-specification(s)]>
specifies a style element to use for the entire table. For information about the arguments of this option and how it is used, see STYLE= in the PROC TABULATE statement.

Note:   The list of attributes that you can set or change with the STYLE= option in the TABLE statement differs from that of the PROC TABULATE statement.  [cautionend]

You can set or change the following attributes with the STYLE= option in the TABLE statement. These attributes apply to the table as a whole. Attributes that you apply in the PROC TABULATE statement and in other locations in the PROC TABULATE step apply to cells within the table.

BACKGROUND= FONT_WIDTH=*
BACKGROUNDIMAGE= FOREGROUND=*
BORDERCOLOR= FRAME=
BORDERCOLORDARK= HTMLCLASS=
BORDERCOLORLIGHT= JUST=
BORDERWIDTH= OUTPUTWIDTH=
CELLPADDING= POSTHTML=
CELLSPACING= POSTIMAGE=
FONT=* POSTTEXT=
FONT_FACE=* PREHTML=
FONT_SIZE=* PREIMAGE=
FONT_STYLE=* PRETEXT=
FONT_WEIGHT=* RULES=
*When you use these attributes in this location, they affect only the text that is specified with the PRETEXT=, POSTTEXT=, PREHTML=, and POSTHTML= attributes. To alter the foreground color or the font for the text that appears in the table, you must set the corresponding attribute in a location that affects the cells rather than the table.

For more information about style attributes, see What Style Attributes Can Base Procedures Specify? .

Note:   You can use braces ({ and }) instead of square brackets ([ and ]).  [cautionend]
Alias: S=
Restriction: This option affects only the HTML and Printer output.
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 HTML Output


Constructing Dimension Expressions
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, the leftmost dimension defines pages, the middle dimension defines rows, and the rightmost dimension defines columns. If two dimensions are specified, the left defines rows, and the right defines columns. If a single dimension is specified, it defines columns.

A dimension expression is composed of elements and operators.

Elements That You Can Use in a Dimension Expression

analysis variables
(see VAR Statement ).

class variables
(see CLASS Statement ).

the universal class variable ALL
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, enclose the name of the universal class variable in quotes.  [cautionend]

keywords for statistics
Requirement: To compute standard error or a t-test, you must use the default value of VARDEF=, which is DF.
Featured in: Reporting on Multiple-Response Survey Data and Using Denominator Definitions to Display Basic Frequency Counts and Percentages

format modifiers
define how to format values in cells. Cross a format modifier with the elements that produce the cells that you want to format. Format modifiers have the form
   f=format
Tip: Format modifiers have no effect on CLASS variables.
See also: For more information on specifying formats in tables, see Formatting Values in Tables .
Featured in: Summarizing Information with the Universal Class Variable ALL

labels
temporarily replace the names of variables and statistics. Labels affect only the variable or statistic that immediately precedes the label. Labels have the form
      stat-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. Use ROW=FLOAT in the TABLE statement to remove the space for blank row headings.
Featured in: Customizing Row and Column Headings and Eliminating Row Headings

style--element specifications
specify style elements for page dimension text, continuation messages, headings, or data cells. For details, see Specifying Style Elements in Dimension Expressions .

You can also form dimension expressions by combining any of these elements.

Operators That You Can Use in a Dimension Expression

asterisk *
creates categories from the combination of values of the class variables and constructs the appropriate headers for the dimension. If one of the elements is an analysis variable, the statistics for the analysis variable are calculated for the categories that are created by the class variables. This process is called crossing.
Featured in: Creating a Basic Two-Dimensional Table

(blank)
places the output for each element immediately after the output for the preceding element. This process is called concatenation.
Featured in: Summarizing Information with the Universal Class Variable ALL

parentheses ()
group elements and associate an operator with each concatenated element in the group.
Featured in: Summarizing Information with the Universal Class Variable ALL

angle brackets <>
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


Specifying Style Elements in Dimension Expressions

You can specify a style element in a dimension expression to control the appearance in HTML and Printer output of the following table elements:
analysis variable name headings
class variable name headings
class variable level value headings
data cells
keyword headings
page dimension text
Specifying a style element in a dimension expression is useful when you want to override a style element that you have specified in another statement, such as the PROC TABULATE, CLASS, CLASSLEV, KEYWORD, TABLE, or VAR statements.

The syntax for specifying a style element in a dimension expression is
[STYLE<(CLASSLEV)>=<style-element-name |
<PARENT>><[style-attribute-specification(s)]>]

Some examples of style elements in dimension expressions are
dept={label='Department' 
      style=[foreground=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 }).  [cautionend]
With the exception of (CLASSLEV), all arguments are described in STYLE= in the PROC TABULATE statement.

(CLASSLEV)
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)=
            [foreground=yellow]]*sales;

Note:   This option is used only in dimension expressions.  [cautionend]

For an example that shows how to specify style elements within dimension expressions, see Specifying Style Elements for HTML Output .


Chapter Contents

Previous

Next

Top of Page

Copyright 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.