TEMPLATE Procedure: Creating Crosstabulation Table Templates |
Creates a crosstabulation table template.
DEFINE CROSSTABS table-path </
STORE=libref.template-store>;
|
<table-attribute-1;
<...table-attribute-n>;>
|
|
DEFINE CELLVALUE
cellvalue;
|
statements-and-attributes;
|
|
|
DEFINE HEADER
header-name;
|
statements-and-attributes;
|
|
|
DEFINE FOOTER
footer-name;
|
statements-and-attributes;
|
|
|
DYNAMIC
variable-1 <'text-1'> <...variable-n
<'text-n'>>;
|
|
DEFINE CROSSTABS Statements
Task |
Statement |
Set one or more cell attributes |
crosstabs-attributes
|
Specify the order in which the cellvalues are stacked in the cells |
CELLVALUE
|
Define a value that appears in the crosstabulation table's cells |
DEFINE CELLVALUE
|
Create a template for a crosstabulation table header |
DEFINE HEADER
|
Create a template for a crosstabulation table footer |
DEFINE FOOTER
|
Define a symbol that references a value that the data component supplies
from the procedure |
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
|
Provide information about the crosstabulation table |
NOTES
|
End a template, or end the editing of a template |
END
|
- table-path
-
specifies where to store the crosstabulation table template.
A table-path consists of one or more names, separated by periods. Each name
represents a directory in a template store, which is a type of SAS file. For
more information on template stores, see Understanding Item Stores, Template Stores, and Directories. PROC TEMPLATE writes the template to the
first writable template store in the current path.
Requirement: |
Crosstabulation table templates
must be named CrossTabFreqs. |
- STORE=
template-store
-
specifies the template store in which to store the crosstabulation
template. If the template store does not exist, it is created.
Restriction: |
The STORE= option does not become
part of the template. |
Requirement: |
The STORE= option must be proceeded
by the forward slash (/) symbol. |
Restriction: |
If the template is nested inside
another template, do not use the STORE= option for the nested template, because
the nested template is stored where the original template is stored. |
This section lists all of the attributes that you can use in a crosstabulation
template.
Crosstabulation Attributes
Task |
Statement |
Specify a style element and any changes to its attributes to use for
the cellvalues in the non-summary rows and columns |
CELL_STYLE=
|
Specify the name of the header to use over the column variable value
columns in the table |
COLS_HEADER=
|
Specify the style element and any changes to its attributes to use for
the cellvalues in the last row in the table |
COL_TOTAL_STYLE=
|
Specify the style element and any changes to its attributes to use for
the column variable values used as headers over the column variable value
columns |
COL_VAR_STYLE=
|
Specify the style element and any changes to its attributes to use for
the cellvalues in the rightmost column of the last row in the table |
GRAND_TOTAL_STYLE=
|
Specify a label for the table |
LABEL=
|
Specify the style element and any changes to its attributes to use for
the legend table that appears near the upper-left corner of the table |
LEGEND_STYLE=
|
Specify the name of the header to use over the row variable values (leftmost)
column in the table |
ROWS_HEADER=
|
Specify the style element and any changes to its attributes to use for
the cellvalues in the cells that contain row totals |
ROW_TOTAL_STYLE=
|
Specify the style element and any changes to its attributes to use for
the row variable values in the leftmost column of the table |
ROW_VAR_STYLE=
|
Specify a style element and any changes to its attributes to use for
the table |
STYLE=
|
-
CELL_STYLE=<style-element-name><[style-attribute-specification(s)]>
-
specifies the style element and any changes to its attributes
you can use for the cellvalues in the non-summary rows and columns. This refers
to the cellvalues that are not in the row totals column (see ROW_TOTAL_STYLE),
the column totals row (see COL_TOTAL_STYLE), or the grand total cell (see
GRAND_TOTAL_STYLE).
-
COLS_HEADER=header-name
-
specifies the name of the header to use over the column
variable value columns in the table.
-
COL_TOTAL_STYLE=<style-element-name><[style-attribute-specification(s)]>
-
specifies the style element and any changes to its attributes
to use for the cellvalues in the last row in the table.
-
COL_VAR_STYLE=<style-element-name><[style-attribute-specification(s)]>
-
specifies the style element and any changes to its attributes
to use for the column variable values used as headers over the column variable
value columns.
-
GRAND_TOTAL_STYLE=<style-element-name><[style-attribute-specification(s)]>
-
specifies the style element and any changes to its attributes
to use for the cellvalues in the rightmost column of the last row in the table.
-
LABEL="text"
-
specifies a label for the table.
-
LEGEND_STYLE=<style-element-name><[style-attribute-specification(s)]>
-
specifies the style element and any changes to its attributes
to use for the legend table that appears near the upper-left corner of the
table.
-
ROWS_HEADER=header-name
-
specifies the name of the header to use over the row variable
values (leftmost) column in the table.
- ROW_TOTAL_STYLE=<style-element-name><[style-attribute-specification(s)]>
-
specifies the style element and any changes to its attributes
to use for the cellvalues that contain row totals.
-
ROW_VAR_STYLE=<style-element-name><[style-attribute-specification(s)]>
-
specifies the style element and any changes to its attributes
to use for the row variable values in the leftmost column of the table.
-
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 style. 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 Table style element that SAS is provides is uniquely designed to describe
elements necessary to a 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
|
Defines a
symbol that references
a value that the data component supplies from the procedure or DATA step.
Tip: |
A dynamic variable that is defined in a template
is available to that template and all the templates that it contains.
|
DYNAMIC dynamic-variable(s) ;
|
- dynamic- variable(s)
-
is a variable that is defined by SAS in the crosstabulation
template. After a dynamic variable has been defined, you can use it in the
TEXT statement within a footer or header template.
- FMISSING
-
is the number of missing values in the table.
Requirement: |
The FMISSING dynamic variable must
be specified by the DYNAMIC statement before you can use the dynamic variable
in an expression. |
- NOTITLE
-
is set to 1 if the PROC FREQ's NOTITLE option was used,
and it is set to 0 if the NOTITLE option was not used.
Requirement: |
The NOTITLE dynamic variable must
be specified by the DYNAMIC statement before you can use the dynamic variable
in an expression. |
- SAMPLESIZE
-
is set to 0 if the table is empty. Otherwise, it is set
to 1.
Requirement: |
The SAMPLESIZE dynamic variable
must be specified by the DYNAMIC statement before you can use the dynamic
variable in an expression. |
- STRATNUM
-
is the current stratum number if the table has multiple
strata. If the table has only one stratum, then the value is 0.
- STRATAVARIABLENAMES
-
is a string that identifies the current stratum by the name
of the stratum variables.
var-1=value-1<var-n=value-n>
|
- var-1-var-n
-
specifies the stratum variables.
- value-1-value-n
-
specifies the values of the stratum variables.
Tip: |
The value is undefined if the table has
only one stratum. |
Requirement: |
The DYNAMIC statement must specify
the STRATAVARIABLELABELS dynamic variables before the dynamic variables can
be used in an expression. |
- STRATAVARIABLELABELS
-
is a string that identifies the current stratum by the
label of the stratum variables.
var-1=value-1<var-n=value-n>
|
- var-1-var-n
-
specifies the stratum variables.
- value-1-value-n
-
specifies the values of the stratum variables.
Tip: |
The value is undefined when the table has
only one stratum. |
Requirement: |
The DYNAMIC statement must specify
the STRATAVARIABLELABELS dynamic variables before you can use the dynamic
variables in an expression. |
Declares a symbol as a footer in the table and specifies the order
of the footers.
FOOTER footer-specification(s);
|
- footer-specification(s)
-
specifies a symbol defined by the DEFINE FOOTER statement
within the same table template.
Default: |
If you omit a FOOTER statement, ODS
creates a footer for each footer template (DEFINE FOOTER statement) and places
the footers in the same order that the footer templates have in the table
template. |
See
also: |
DEFINE FOOTER Statement |
Declares a symbol as a header in the table and specifies the order
of the headers.
HEADER header-specification(s);
|
- header-specification(s)
-
specifies a symbol defined by the DEFINE HEADER statement
within the same table template.
Default: |
If you omit a HEADER statement, then
ODS makes a header for each header template (DEFINE HEADER statement) and
places the headers in the same order that the header templates have in the
table
template. |
Provides information about a template.
Tip: |
The NOTES statement becomes part of the compiled
template, which you can view with the SOURCE statement. SAS comments do not
become part of the compiled template.
|
- 'text'
-
provides information about the
template.
Ends a template.
Copyright © 2008 by SAS Institute Inc., Cary, NC, USA. All rights reserved.