Chapter Contents |
Previous |
Next |
The TEMPLATE Procedure |
Requirement: | An END statement must be the last statement in the definition. |
Interaction: | A table definition can contain one or more column, header, or footer definitions. |
Featured in: | Creating a New Table Definition, Setting the Style Element for Cells Based on Their Values, and Creating a Stand-alone Style Definition |
DEFINE TABLE table-path </
STORE=libname.template-store>;
|
To do this ... | Use this 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 definition 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 definition 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 definition 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 definition, or end the editing of a definition. | END |
Required Arguments |
Options |
Availability: | Version 8 of the SAS System |
Table Attributes |
This section lists all the attributes that you can use in a table definition. For all attributes that support a value of ON, the following forms are equivalent:
ATTRIBUTE-NAME ATTRIBUTE-NAME=ONFor all attributes that support a value of variable, variable can be any variable that you declare in the table definition with the DYNAMIC, MVAR, or NMVAR statement. If the attribute is a boolean, the value of variable should resolve to one of the following:
ON | YES | 0 |
_ON_ | _YES_ | FALSE |
1 | OFF | NO |
TRUE | _OFF_ | _NO_ |
To do this ...* | Use this attribute | |
---|---|---|
Influence the layout of the table | ||
Specify whether or not 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= | |
Specify whether or not to center each data panel independently if the entire table does not fit in one data panel | CENTER= | |
Specify whether or not to force a new page before printing the table | NEWPAGE= | |
Specify the number of sets of columns to place on a page | PANELS= | |
Specify the number of blank characters to place between sets of columns when PANELS= is in effect | PANELSPACE= | |
Specify the number of lines that must be available on the page in order to print the body of the table | REQUIRED_SPACE= | |
Specify the number of lines to place between the previous output object and the current one | TOPSPACE= | |
Influence the layout of rows and columns | ||
Specify the maximum number of blank characters to place between columns | COL_SPACE_MAX= | |
Specify the minimum number of blank characters to place between columns | COL_SPACE_MIN= | |
Specify the name of the column whose value provides formatting information about the space before each row of the definition | CONTROL= | |
Specify whether or not to double space between the rows of the table | DOUBLE_SPACE= | |
Specify whether or not extra space is evenly divided among all columns of the table | EVEN= | |
Specify whether or not to split a long stacked column across page boundaries | SPLIT_STACK= | |
Influence the display of the values in header cells and data cells | ||
Specify whether or not to suppress the blanking of 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= | |
Specify which format to use if both a column definition and a data component specify one | DATA_FORMAT_OVERRIDE= | |
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= | |
Specify whether or not to order the columns by their order in the data component | ORDER_DATA= | |
Specify the source of the values for the format width and the decimal width if they are not specified | USE_FORMAT_DEFAULTS= | |
Use the column name as the column header if neither the column definition nor the data component specifies a header | USE_NAME= | |
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= | |
Specify the number of blank lines to place between the last row of headers and the first row of data | HEADER_SPACE= | |
Specify whether or not to draw a continuous line above the first table footer (or, if there is no table footer, below the last row of the data on a page) | OVERLINE= | |
Specify whether or not to print table footers and any overlining of the table footers | PRINT_FOOTERS= | |
Specify whether or not to print table headers and any underlining of the table headers | PRINT_HEADERS= | |
Specify whether or not to draw a continuous line under the last table header (or, if there is no table header, under the last row of the data on a page) | UNDERLINE= | |
Influence the HTML output | ||
Specify whether or not to place the object in a table of contents if you create one | CONTENT= | |
Specify the label to use for the output object in the contents file, the Results window, and the trace record | CONTENTS_LABEL= | |
Specify whether or not to print the current byline before the table | BYLINE= | |
Define the characters to use as the line-drawing characters in the table | FORMCHAR= | |
Specify a label for the table | LABEL= | |
Specify the table that the current definition inherits from | PARENT= | |
Specify the style element to use for the table and any changes to the attributes | STYLE= | |
Specify the special data set type of a SAS data set | TYPE= | |
*Different attributes affect different ODS destinations. For details, consult the documentation for a specific attribute. |
Default: | OFF |
ODS Destinations: | Listing and Printer |
Default: | OFF |
Restriction: | This attributes 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. |
ODS Destinations: | All but Output |
Default: | ON |
ODS Destinations: | Listing and Printer |
Default: | OFF |
ODS Destinations: | All but Output |
Featured in: | Creating a Stand-alone Style Definition |
Default: | 4 |
ODS Destinations: | Listing |
Default: | 2 |
ODS Destinations: | Listing |
Default: | ON |
ODS Destinations: | HTML |
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. |
ODS Destinations: | HTML |
If the value in the control column is ... | This occurs before the row is created ... |
---|---|
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 |
a 'b' or a 'B' | ODS tries to insert a panel break if the entire table does not fit in the space that is provided |
Default: | none |
ODS Destinations: | Listing and Printer |
Default: | OFF |
Availability: | Version 8 of the SAS System |
ODS Destinations: | All |
Default: | OFF |
ODS Destinations: | Listing |
Featured in: | Customizing a Table Definition that a SAS Procedure Uses and Creating a New Table Definition |
Default: | OFF |
ODS Destinations: | Listing |
Default: | 1 |
ODS Destinations: | Listing |
formchar='*+'
Default: | The SAS system option FORMCHAR= specifies the default formatting characters. |
Tip: | You can use any character in formatting-characters, including hexadecimal characters. If you use hexadecimal characters, you must put an x after the closing quote. For instance, the following 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 |
ODS Destinations: | Listing |
Default: | 1 |
ODS Destinations: | Listing |
Default: | OFF |
Interaction: | JUSTIFY=ON can interfere with decimal alignment. |
Tip: | If you translate numeric data to character data, you may need to use JUSTIFY= to align the data as you wish. |
ODS Destinations: | Listing |
Default: | PROC TEMPLATE uses the first of the
following that it finds:
|
ODS Destinations: | All |
Default: | OFF |
Restriction: | If the table is the first item on the page, ODS ignores this attribute. |
ODS Destinations: | All but Output |
Default: | OFF
When ORDER_DATA=OFF, the default order for columns is the order that they are specified in the COLUMN statement. If you do not use a COLUMN statement, the default order for columns is the order in which you define them in the definition. |
Tip: | The Output destination always uses the order of the columns in the data component when it creates an output data set. |
Interaction: | ORDER_DATA is most useful for ordering generic columns. |
ODS Destinations: | All but Output |
Default: | OFF |
See also: | UNDERLINE= (for tables), UNDERLINE= (for columns), and OVERLINE= (for columns) |
ODS Destinations: | Listing |
Featured in: | Customizing a Table Definition that a SAS Procedure Uses |
Tip: | If the number of panels that is specified is larger than the number of panels that can fit on the page, the definition creates as many panels as it can. Let the table definition put your data in the maximum number of panels that can fit on the page by specifying a large number of panels (for example, 99). |
ODS Destinations: | Listing and Printer |
Default: | 2 |
ODS Destinations: | Listing |
When you specify a parent, all the attributes and statements that are specified in the parent's definition are used in the current definition unless the current definition specifically overrides them.
ODS Destinations: | All |
Default: | ON |
See also: | OVERLINE= |
ODS Destinations: | All but Output |
Default: | ON |
Interaction: | When used in a table definition, PRINT_HEADERS affects only headers for the table, not the headers for individual columns. (See the discussion of the PRINT_HEADERS column attribute.) |
See also: | UNDERLINE= |
ODS Destinations: | All but Output |
Default: | 3 |
ODS Destinations: | Listing and Printer |
Default: | OFF |
ODS Destinations: | Listing |
Note: You can use braces
({ and }) instead of square brackets ([ and ]).
table
. The style definitions that SAS Institute provides do not
provide another style element that you would be likely to want to use instead
of table
. However, you may have a user-defined
style element at your site that would be appropriate to specify.
The style element provides the basis for rendering the table. Additional style attributes that you provide can modify the rendering.
For information on finding an up-to-date list of the style definitions and for viewing a style definition so that you can see the style elements that are available, see Customizing Presentation Aspects of ODS Output. For information about the default style definition that ODS uses, see What Is the Default Style Definition Like?.
style-element-name can be either the name of a style element or a variable whose value is a style element.
Default: | table |
style-attribute-name=style-attribute-value |
For information on the style attributes that you can specify, see Style Attributes.
ODS Destinations: | HTML and Printer |
Default: | 1 |
ODS Destinations: | Listing and Printer |
Restriction: | PROC TEMPLATE does not
verify that
|
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. |
Destination: | Output |
Default: | OFF |
See also: | OVERLINE= (for tables), UNDERLINE= (for columns), and OVERLINE= (for columns) |
ODS Destinations: | Listing |
Featured in: | Customizing a Table Definition that a SAS Procedure Uses and Creating a New Table Definition |
Default: | OFF |
ODS Destinations: | All but Output |
Default: | OFF |
Tip: | Use this attribute when column names are derived from a data set and the columns are generic. |
ODS Destinations: | All but Output |
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= |
ODS Destinations: | Listing and Printer |
Default: | OFF |
See also: | WRAP= |
ODS Destinations: | Listing and Printer |
Restriction: | The CELLSTYLE-AS statement in a table definition applies only to numeric variables. To specify style elements for individual values of a character variable, use CELLSTYLE-AS in the definition of that column. (See DEFINE COLUMN Statement.) |
CELLSTYLE expression-1 AS <style-element-name><[style-attribute-specification(s)]> <..., expression-n AS <style-element-name><[style-attribute-specification(s)]>>; |
Required Arguments |
If expression resolves to TRUE (a non-zero value), the style element that is specified is used for the current cell. If expression is FALSE (zero), the next expression in the statement is evaluated. Thus, you can string multiple expressions together to format cells conditionally.
Restriction: | You may not reference the values of other columns in expression. |
Tip: | Using an expression of 1 as the last expression in the CELLSTYLE-AS statement sets the style element for any cells that did not meet an earlier condition. |
style-attribute-name=style-attribute-value |
Options |
The style elements that you would be most likely to use with the CELLSTYLE-AS statement are
The style element provides the basis for rendering the cell. Additional style attributes that you provide can modify the rendering.
Featured in: | Creating a New Table Definition |
COLUMN column(s); |
Required Arguments |
To stack values for two or more variables in the same column, put parentheses around the variables that you want to stack. In such a case, the column header for the first column inside the parentheses becomes the header for the column that contains all the variables inside parentheses. For instance, the following COLUMN statement produces a definition in which
column name (city state) (homephone workphone);
You can use the asterisk (*) in the COLUMN statement to change the layout of stacking variables. An asterisk between groups of variables in parentheses stacks the first item in the first set of parentheses above the first item in the next set of parentheses, and so on until the last group of parentheses is reached. Then, the second item in the first group is stacked above the second item in the second group, and so on. For instance, the following COLUMN statement produces a report in which
column name (city state) * (homephone workphone);
Default: | If you do not use a COLUMN statement,
ODS makes a column for each column definition (DEFINE COLUMN statement), and
places the columns in the same order that the column definitions have in the
table definition.
If you use a COLUMN statement but do not use a DEFINE COLUMN statement for any of the columns, ODS uses a default column definition that is based on the type of data in the column. |
Tip: | You can use a list of variable names, such as DAY1-DAY10, to specify multiple variables. |
Main discussion: | DEFINE COLUMN Statement, DEFINE FOOTER Statement, and DEFINE HEADER Statement |
DEFINE definition-type
definition-name;
|
Required Arguments |
COLUMN | HEADER |
FOOTER |
The definition-type determines what other statements and what attributes can go in the definition. For details, see the documentation for the corresponding DEFINE statement.
Restriction: | definition-name
must be a single-level name.
Note: If you want to reference the definition
that you are creating from another definition, you must create it outside
the table definition. |
Scope: | You can use the DYNAMIC statement in the definition of a table, column, header, or footer. A dynamic variable that is defined in a definition is available to that definition and to all the definitions that it contains. |
Featured in: | Creating a Stand-alone Style Definition |
DYNAMIC variable-1 <'text-1'> <... variable-n <'text-n'>>; |
Required Arguments |
Tip: | Dynamic variables are most useful to the authors of SAS procedures and to DATA step programmers. |
Options |
FOOTER footer-specification(s); |
Required Arguments |
See also: | SPLIT= |
Default: | If you do not use a FOOTER statement, ODS makes a footer for each footer definition (DEFINE FOOTER statement), and places the footers in the same order that the footer definitions have in the table definition. |
HEADER header-specification(s); |
Required Arguments |
See also: | SPLIT= |
Default: | If you do not use a HEADER statement, ODS makes a header for each header definition (DEFINE HEADER statement), and places the headers in the same order that the header definitions have in the table definition. |
Featured in: | Creating a New Table Definition |
Scope: | You can use the MVAR statement in the definition of a table, column, header, or footer. A macro variable that is defined in a definition is available to that definition and to all the definitions that it contains. |
Featured in: | Creating a New Table Definition and Creating a Stand-alone Style Definition |
MVAR variable-1 <'text-1'> <... variable-n <'text-n'>>; |
Required Arguments |
Tip: | You must declare macro variables this way in a definition. For example, to use the automatic macro variable SYSDATE9 in a definition, declare it in an MVAR statement and reference it as SYSDATE9, without an ampersand, in your PROC TEMPLATE step. If you use the ampersand, the macro resolves when the definition is compiled instead of when ODS binds the definition to the data component. |
Options |
Scope: | You can use the NMVAR statement in the definition of a table, column, header, or footer. A macro variable that is defined in a definition is available to that definition and to all the definitions that it contains. |
Featured in: | Setting the Style Element for Cells Based on Their Values |
NMVAR variable-1 <'text-1'> <... variable-n <'text-n'>>; |
Required Arguments |
Tip: | You must declare macro variables this way in a definition. For instance, to use a macro variable as a number, declare it in an NMVAR statement and reference it without an ampersand. If you use the ampersand, the macro resolves when the definition is compiled instead of when ODS binds the definition to the data component. |
Options |
Tip: | The NOTES statement becomes part of the compiled column definition, which you can view with the SOURCE statement, whereas SAS comments do not. |
Featured in: | Setting the Style Element for Cells Based on Their Values |
NOTES 'text'; |
Required Arguments |
Restriction: | The TRANSLATE-INTO statement in a table definition applies only to numeric variables. To translate the values of a character variable, use TRANSLATE-INTO in the definition of that column. (See DEFINE COLUMN Statement). |
Featured in: | Setting the Style Element for Cells Based on Their Values |
TRANSLATE expression-1 INTO expression-2 <..., expression-n INTO expression-m>; |
Required Arguments |
If expression-1 resolves to TRUE (a non-zero value), the translation that is specified is used for the current cell. If expression-1 is FALSE (zero), the next expression in the statement is evaluated. Thus, you can string multiple expressions together to format cells conditionally.
Restriction: | You may not reference the values of other columns in expression-1. |
Tip: | Using an expression of 1 as the last expression in the TRANSLATE-INTO statement specifies a translation for any cells that did not meet an earlier condition. |
Restriction: | expression-2 must resolve to a character value, not a numeric value. |
Restriction: | You may not reference the values of other columns in expression-2. |
Tip: | When you translate a numeric value to a character value, the table definition does not try to apply the numeric format that is associated with the column. Instead, it simply writes the character value into the format field, starting at the left. If you want the value to be right justified, use the JUSTIFY=ON attribute. |
See also: | JUSTIFY= |
END; |
Chapter Contents |
Previous |
Next |
Top of Page |
Copyright 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.