DEFINE TABLE Statements
Task |
Statement |
Set one or more table attributes |
table-attribute(s)
|
Set the style element of the cells in the table that
contain numeric variables according to the values of the variables |
CELLSTYLE AS
|
Declare a symbol as a column in the table and specify
the order of the columns |
COLUMN
|
Create a template for a column, header, or footer |
DEFINE
|
Define a symbol that references a value that the data
component supplies from the procedure or DATA step |
DYNAMIC
|
Declare a symbol as a footer in the table and specify
the order of the footers |
FOOTER
|
Declare a symbol as a header in the table and specify
the order of the headers |
HEADER
|
Define a symbol that references a macro variable. ODS
will use the value of the variable as a string. References to the macro variable
are resolved when ODS binds the template and the data component to produce
an output object. |
MVAR
|
Define a symbol that references a macro variable. ODS
will convert the value of the variable to a number (stored as a double) before
use. References to the macro variable are resolved when ODS binds the template
and the data component to produce an output object. |
NMVAR
|
Provide information about the table |
NOTES
|
Translate the specified numeric values to other values |
TRANSLATE INTO
|
End a template, or end the editing of a template |
END
|
Table Attributes
Task |
Attribute |
Destinations |
Influence the layout of the table |
|
|
Specify whether to try to place the same number of columns
in each data panel if the entire table does not fit in one data panel |
BALANCE |
LISTING, printer family, and RTF |
Specify whether to center each data panel independently
if the entire table does not fit in one data panel |
CENTER |
LISTING, printer family, RTF |
Specify whether to force a new page before printing
the table |
NEWPAGE |
All except OUTPUT |
Specify the number of sets of columns to place on a
page |
PANELS= |
LISTING and printer family |
Specify the number of blank characters to place between
sets of columns when PANELS= is in effect |
PANEL_SPACE= |
LISTING |
Specify the number of lines that must be available on
the page in order to print the body of the table |
REQUIRED_SPACE= |
LISTING and printer family |
Specify the number of lines to place between the previous
output object and the current one |
TOP_SPACE= |
LISTING and printer family |
Specify whether to split a table that is too wide to
fit in the space that is provided or to wrap each row of the table |
WRAP |
LISTING and printer family |
Specify whether to add a double space after the last
line of a single row when the row is wrapped |
WRAP_SPACE |
LISTING and printer family |
Influence the layout of rows and columns |
|
|
Specify the maximum number of blank characters to place
between columns |
COL_SPACE_MAX= |
LISTING |
Specify the minimum number of blank characters to place
between columns |
COL_SPACE_MIN= |
LISTING |
Specify the name of the column whose value provides
formatting information about the space before each row of the template |
CONTROL= |
All except OUTPUT |
Specify whether to double space between the rows of
the table |
DOUBLE_SPACE |
LISTING |
Specify whether extra space is evenly divided among
all columns of the table |
EVEN |
LISTING |
Specify whether to split a long stacked column across
page boundaries |
SPLIT_STACK |
LISTING |
Influence the display of the values in header
cells and data cells |
|
|
Specify whether to suppress blanking the value in a
column that is marked with the BLANK_DUPS column attribute if the value changes
in a previous column that is also marked with the BLANK_DUPS attribute |
CLASSLEVELS= |
LISTING and printer family |
Specify which format to use if both a column template
and a data component specify a format |
DATA_FORMAT_OVERRIDE |
All |
Specify whether to justify the format fields within
the columns or to justify the values within the columns without regard to
the format fields |
JUSTIFY |
LISTING |
Specify whether to order the columns by their order
in the data component |
ORDER_DATA |
All except OUTPUT |
Specify the source of the values for the format width
and the decimal width if they are not specified |
USE_FORMAT_DEFAULTS |
All |
Use the column name as the column header if neither
the column template nor the data component specifies a header |
USE_NAME |
All |
Influence the layout of headers and footers |
|
|
Specify the number of blank lines to place between the
last row of data and the first row of output |
FOOTER_SPACE= |
LISTING |
Specify the number of blank lines to place between the
last row of headers and the first row of data |
HEADER_SPACE= |
LISTING |
Specify whether to draw a continuous line above the
first table footer or, if there is no table footer, below the last row of
data on a page |
OVERLINE |
LISTING |
Specify whether to print table footers and any overlining
of the table footers |
PRINT_FOOTERS |
All except OUTPUT |
Specify whether to print table headers and any underlining
of the table headers |
PRINT_HEADERS |
All except OUTPUT |
Specify whether to draw a continuous line under the
last table header or, if there is no table header, then above the last row
of data on a page |
UNDERLINE |
LISTING |
Influence the HTML output |
|
|
Specify whether to place the output object in a table
of contents, if you create a table of contents |
CONTENTS |
HTML |
Specify the label to use for the output object in the
contents file, the Results window, and the trace record |
CONTENTS_LABEL= |
HTML, PDF, PRINTER, PS PDFMARK |
Other table attributes |
|
|
Specify an alternate description for the table * |
ALT= |
MARKUP |
Control whether BY lines are printed above each BY group |
BYLINE= |
All except OUTPUT |
Define the characters to use as the line-drawing characters
in the table |
FORMCHAR= |
LISTING |
Specify a label for the table |
LABEL= |
All |
Specify a long description for the table * |
LONGDESC= |
MARKUP |
Specify the table that the current template inherits
from |
PARENT= |
All |
Specify the style element to use for the table and any
changes to the attributes |
STYLE= |
Markup family, printer family, and RTF |
Specify the special data set type of a SAS data set |
TYPE= |
OUTPUT |
*
SAS
includes these accessibility and compatibility features
that improve the usability of SAS for users with disabilities. These features
are related to accessibility standards for electronic information technology
adopted by the U.S. Government under Section 508 of the U.S. Rehabilitation
Act of 1973, as amended. |
-
ALT=
"text"
-
specifies an alternate description of the
table.
Requirement: |
The text must be
enclosed with quotation marks. |
Tip: |
The ALT= attribute is valid
only in markup family destinations. |
Note: SAS includes this accessibility and compatibility
feature that improves the usability of SAS for users with disabilities. This
feature is related to accessibility standards for electronic information technology
adopted by the U.S. Government under Section 508 of the U.S. Rehabilitation
Act of 1973, as amended.
-
BALANCE <=ON | OFF |
variable>
-
specifies whether to try to place the same
number of columns in each data panel if the entire table does not fit in one
data panel.
Default: |
OFF |
Tip: |
The BALANCE attribute is
valid only in the LISTING, printer family, and RTF |
-
BYLINE <=ON | OFF | variable>
-
controls whether BY lines are printed above
each BY group in a configuration file, SAS invocation, OPTIONS statement,
or Systems Options window.
Category: |
PROC OPTIONS GROUP= LISTCONTROL |
Default: |
OFF |
Restriction: |
This attribute applies
only if the table is not the first one on the page. If BY-group processing
is in effect, a byline automatically precedes the first table on the page. |
Tip: |
The BYLINE attribute is
valid in all destinations except the OUTPUT destination. |
-
CENTER <=ON | OFF | variable>
-
specifies whether to center each data panel
independently if the entire table does not fit in the space that is provided.
Default: |
ON |
Tip: |
The CENTER attribute is
valid only in the LISTING, printer family, and RTF
destinations. |
-
CLASSLEVELS <=ON | OFF | variable>
-
specifies whether to suppress blanking the
value in a column that is marked with the BLANK_DUPS column attribute if the
value changes in a previous column that is also marked with the BLANK_DUPS
attribute.
Default: |
OFF |
Tip: |
The CLASSLEVELS attribute
is valid for all destinations except the OUTPUT destination. |
Featured in: |
Creating a Stand-Alone Style |
-
COL_SPACE_MAX= positive-integer
| variable
-
specifies the maximum number of blank characters
to place between the columns.
Default: |
4 |
Tip: |
The COL_SPACE_MAX= table
attribute is valid only in the LISTING
destination. |
-
COL_SPACE_MIN= positive-integer
| variable
-
specifies the minimum number of blank characters
to place between the columns.
Default: |
2 |
Tip: |
The COL_SPACE_MIN= attribute
is valid only in the LISTING destination. |
-
CONTENTS
<=ON | OFF | variable>
-
specifies whether to place the output object
in a table of contents, if you create a table of contents.
Default: |
ON |
Tip: |
The CONTENTS attribute is
valid in markup family and printer family destinations. |
-
CONTENTS_LABEL= "string"
| variable
-
specifies the label to use for the output
object in the contents file, the Results window, and the trace record.
Default: |
If the SAS system option
LABEL is in effect, the default label is the object's label. If LABEL is not
in effect, the default label is the object's name. |
Tip: |
The CONTENTS_LABEL= attribute
is valid only in markup family and printer family destinations. |
-
CONTROL=column-name | variable
-
specifies the name of the column whose values
provide formatting information about the space before each row of the template.
The value of CONTROL= should be the name of a column of type character with
a length equal to 1.
Values in the Control Column
Column Control Value |
Result |
A digit from 1-9 |
The specified number of blank lines precedes the current
row. |
A hyphen (-) |
A row of underlining precedes the current row. |
"b" or "B" |
ODS tries to insert a panel break if the entire table
does not fit in the space that is provided. |
Default: |
None |
Tip: |
The CONTROL= attribute
is valid in all destinations except the OUTPUT destination. |
-
DATA_FORMAT_OVERRIDE<=ON | OFF | variable>
-
specifies which format to use if both a
column template and a data component specify a format.
-
ON
-
uses the format that the data component
specifies.
-
OFF
-
use the format that the column template
specifies.
Default: |
OFF |
Tip: |
The DATA_FORMAT_OVERRIDE
attribute is valid in all destinations. |
-
DOUBLE_SPACE<=ON | OFF | variable>
-
specifies whether to double space between
the rows of the table.
-
EVEN<=ON | OFF | variable>
-
specifies whether extra space is evenly
divided among all columns of the table.
Default: |
OFF |
Tip: |
The EVEN attribute is valid
only in the LISTING destination.LISTING |
-
FOOTER_SPACE=0 | 1 | 2 | variable
-
specifies the number of blank lines to place
between the last row of data and the first row of the table footer.
Default: |
1 |
Tip: |
The FOOTER_SPACE= attribute
is valid only in the LISTING destination. |
-
FORMCHAR= "string" | variable
-
defines the characters to use as the line-drawing
characters in the table. Currently, ODS uses only the second of the 20 possible
formatting characters. This formatting character is used for underlining and
overlining. To change the second formatting character, specify both the first
and second formatting characters. For example, this option assigns the asterisk
(*) to the first formatting character, the plus sign (+) to the second character,
and does not alter the remaining characters:
formchar="*+"
Default: |
The SAS system option
FORMCHAR= specifies the default formatting characters. |
Tip: |
Use any character in formatting-characters,
including hexadecimal characters. If you use hexadecimal characters, then
put an x after the closing quote. For example, this option assigns the hexadecimal
character 2D to the first formatting character, the hexadecimal character
7C to the second character, and does not alter the remaining characters:
formchar="2D7C"x |
Tip: |
The FORMCHAR= attribute
is valid only in the LISTING destination. |
-
HEADER_SPACE=0 | 1 | 2 | variable
-
specifies the number of blank lines to place
between the last row of headers and the first row of data. A row of underscores
is a header.
Default: |
1 |
Tip: |
The HEADER_SPACE= attribute
is valid only in the LISTING destination. |
-
JUSTIFY<=ON | OFF | variable>
-
specifies whether to justify the format
fields within the columns or to justify the values within the columns without
regard to the format fields.
Default: |
OFF |
Interaction: |
JUSTIFY=ON can interfere
with decimal alignment. |
Interaction: |
If the column is
numeric, then values are aligned to the right if you specify JUSTIFY=OFF and
JUST=C. |
Interaction: |
All of the destinations
except for the LISTING destination justify the values in columns as if JUSTIFY=ON
for JUST=R and JUST=L. |
Tip: |
If you translate numeric
data to character data, you might need to use JUSTIFY= to align the data. |
Main
discussion: |
Values in Table Columns and How They Are Justified |
Tip: |
The JUSTIFY attribute is
valid only in the LISTING destination. |
-
LABEL=
"text" | variable
-
specifies a label for the table.
Default: |
ODS uses the first
of the following that it finds:
-
a label that the table template provides
-
a label that
the data component provides
-
the first spanning header in the table.
|
Tip: |
The LABEL= attribute is
valid in all destinations. |
-
LONGDESC= "string"
-
specifies the long description of the table.
Requirement: |
The text must be
enclosed with quotation marks. |
Tip: |
The LONGDESC= attribute
is valid only in markup family destinations. |
Note: SAS includes this accessibility and compatibility
feature that improves the usability of SAS for users with disabilities. This
feature is related to accessibility standards for electronic information technology
adopted by the U.S. Government under Section 508 of the U.S. Rehabilitation
Act of 1973, as amended.
-
NEWPAGE<=ON | OFF |
variable>
-
specifies whether to force a new page before
printing the table.
Default: |
OFF |
Restriction: |
If the table is
the first item on the page, ODS ignores this attribute. |
Tip: |
The NEWPAGE attribute is
valid in all destinations except the OUTPUT destination. |
-
ORDER_DATA<=ON | OFF | variable>
-
specifies whether to order the columns by
their order in the data component.
Default: |
OFF
When ORDER_DATA=OFF, the default order for columns is
the order that they are specified in the COLUMN statement. If you omit a COLUMN
statement, the default order for columns is the order in which you define
them in the template. |
Interaction: |
ORDER_DATA is most
useful for ordering generic columns. |
Tip: |
The ORDER_DATA attribute
is valid in all destinations except the OUTPUT destination. The OUTPUT destination
always uses the order of the columns in the data component when it creates
an output data set. |
-
OVERLINE<=ON | OFF | variable>
-
specifies whether to draw a continuous line
above the first table footer or, if there is no table footer, below the last
row of data on a page. The second formatting character is used to draw the
line.
-
PANELS=positive-integer | variable
-
specifies the number of sets of columns
to place on a page. If the width of all the columns is less than half of the
linesize, display the data in multiple sets of columns so that rows that would
otherwise appear on multiple pages appear on the same page.
Tip: |
If the number of panels
that is specified is larger than the number of panels that can fit on the
page, the template creates as many panels as it can. Let the table template
put data in the maximum number of panels that can fit on the page by specifying
a large number of panels (for example, 99). |
Tip: |
The PANELS= attribute is
valid only in LISTING and printer family destinations. |
-
PANEL_SPACE=positive-integer
| variable
-
specifies the number of blank characters
to place between sets of columns when PANELS= is in effect.
Default: |
2 |
Tip: |
The PANEL_SPACE= attribute
is valid only in the LISTING destination. |
-
PARENT=table-path
-
specifies the table that the current template
inherits from. A table-path consists of one or
more names, separated by periods. Each name represents a directory in a template
store. (A template store is a type of SAS file.) The current template inherits
from the specified table in the first template store in the current path that
you can read from.
When you specify a parent, all of the attributes and
statements that are specified in the parent's template are used in the current
template unless the current template overrides them.
Tip: |
The PARENT= attribute is
valid in all destinations. |
-
PRINT_FOOTERS<=ON |
OFF | variable>
-
specifies whether to print table footers
and any overlining of the table footers.
Default: |
ON |
See also: |
OVERLINE= |
Tip: |
The PRINT_FOOTERS attribute
is valid in all destinations except the OUTPUT destination. |
-
PRINT_HEADERS<=ON | OFF | variable>
-
specifies whether to print the table headers
and any underlining of the table headers.
Default: |
ON |
Interaction: |
When used in a table
template, PRINT_HEADERS affects only headers for the table, not the headers
for individual columns. (See the discussion of the PRINT_HEADERS column attribute .) |
Tip: |
The PRINT_HEADERS attribute
is valid in all destinations except the OUTPUT destination. |
See
also: |
UNDERLINE= |
-
REQUIRED_SPACE=positive-integer
| variable
-
specifies the number of lines that must
be available on the page in order to print the body of the table (The body
of the table is the part of the table that contains the data. It does not
include headers and footers.)
Default: |
3 |
Tip: |
The REQUIRED_SPACE= attribute
is valid in LISTING and printer family destinations. |
-
SPLIT_STACK<=ON | OFF | variable>
-
specifies whether to split a long stacked
column across page boundaries.
Default: |
OFF |
Tip: |
The SPLIT_STACK attribute
is valid only in the LISTING destinations. |
-
STYLE=<style-element-name><[style-attribute-specification(s)]>
-
specifies the style element and any changes
to its attributes to use for the table.
-
style-element-name
-
is the name of the style element to use
to display the table. The style element must be part of a style that is registered
with the Output Delivery System. SAS provides some styles. You can create
customized styles with PROC TEMPLATE (see
DEFINE STYLE Statement).
By default, ODS produces different parts of ODS output with different elements.
For example, by default, a table is produced with the style element Table.
The styles that SAS provides do not provide another style element that you
would be likely to want to use instead of Table. However, you might have a
user-defined style element at your site that would be appropriate to specify.
The style element provides the basis for displaying
the table. Additional style attributes that you provide can modify the display.
style-element-name is either
the name of a style element or a variable whose value is a style element.
-
style-attribute-specification
-
describes the style attribute to change.
Each style-attribute-specification has this general
form:
style-attribute-name=style-attribute-value
|
Default: |
Table |
Requirement: |
Specify either
a style-attribute-specification or a style-element-name with the STYLE= option. |
Tip: |
You can use braces ({ and
}) instead of square brackets ([ and ]). |
Tip: |
If you use the STYLE= attribute
inside a quoted string, then add a space before or after the carriage return
to prevent errors. SAS does not interpret a carriage return as a space. You
must explicitly specify spaces in quoted strings. |
Tip: |
The STYLE= attribute is
valid only in the markup family, printer family, and RTF destinations. |
-
TOP_SPACE=positive-integer
| variable
-
specifies the number of lines to place between
the previous output object and the current one.
Default: |
1 |
Tip: |
The TOP_SPACE= attribute
is valid only in LISTING and printer family destinations. |
-
TYPE=string | variable
-
specifies special type of SAS data set.
Restriction: |
PROC TEMPLATE does not verify the following:
|
Tip: |
Most SAS data sets have
no special type. However, certain SAS procedures, like the CORR procedure,
can create a number of special SAS data sets. In addition, SAS/STAT software
and SAS/EIS software support special data set types. |
Tip: |
The TYPE= attribute is valid
only in the OUTPUT destination. |
-
UNDERLINE<=ON | OFF | variable>
-
specifies whether to draw a continuous line
under the last table header (or, if there is no table header, then above the
first row of data on a page). The second formatting character is used to draw
the line.
-
USE_FORMAT_DEFAULTS<=ON | OFF | variable>
-
specifies the source of the values for the
format width and the decimal width if they are not specified.
-
ON
-
uses the default values, if any, that are
associated with the format name.
-
OFF
-
uses the PROC TEMPLATE defaults.
Default: |
OFF |
Tip: |
The USE_FORMAT_DEFAULTS
attribute is valid in all destinations except the OUTPUT destination. |
-
USE_NAME<=ON | OFF | variable>
-
uses the column name as the column header
if neither the column template nor the data component specifies a header.
Default: |
OFF |
Tip: |
Use this attribute when
column names are derived from a data set and the columns are generic. |
Tip: |
The USE_NAME attribute
is valid in all destinations except the OUTPUT destination. |
-
WRAP<=ON | OFF | variable>
-
specifies whether to split a wide table
into multiple data panels, or to wrap each row of the table so that an entire
row is printed before the next row starts.
Default: |
OFF |
Interaction: |
When ODS wraps
the rows of a table, it does not place multiple values in any column that
contains an ID column. |
See also: |
WRAP_SPACE= and
ID= |
Tip: |
The WRAP attribute is valid
only in LISTING and printer family destinations. |
-
WRAP_SPACE<=ON | OFF | variable>
-
specifies whether to double space after
the last line of a single row of the table when the row is wrapped onto more
than one line.
Default: |
OFF |
See also: |
WRAP= |
Tip: |
The WRAP_SPACE attribute
is valid only in the LISTING, printer family, and RTF
destinations. |