Base SAS 9.1 Procedures Guide, Volumes 1, 2, 3 and 4

Requirements: At least one TABLE statement is required.

Requirements: Depending on the variables that appear in the TABLE statement, a CLASS statement, a VAR statement, or both are required.

Tip: Supports the Output Delivery System. See Output Delivery System on page 32 for details.

ODS Table Name : Table

Reminder: You can use the ATTRIB, FORMAT, LABEL, and WHERE statements. See Chapter 3, Statements with the Same Function in Multiple Procedures, on page 57 for details. You can also use any global statements. See Global Statements on page 18 for a list.

PROC TABULATE < option(s) >;

To do this

Use this statement

Create a separate table for each BY group

BY

Identify variables in the input data set as class variables

CLASS

Specify a style for class variable level value headings

CLASSLEV

Identify a variable in the input data set whose values represent the frequency of each observation

FREQ

Specify a label for a keyword

KEYLABEL

Specify a style for keyword headings

KEYWORD

Describe the table to create

TABLE

Identify variables in the input data set as analysis variables

VAR

Identify a variable in the input data set whose values weight each observation in the statistical calculations

WEIGHT

PROC TABULATE Statement

PROC TABULATE < option(s) >;

To do this

Use this option

Customize the HTML contents link to the output

CONTENTS=

Specify the input data set

DATA=

Specify the output data set

OUT=

Override the SAS system option THREADS NOTHREADS

THREADS NOTHREADS

Enable floating point exception recovery

TRAP

Identify categories of data that are of interest

 

Specify a secondary data set that contains the combinations of values of class variables to include in tables and output data sets

CLASSDATA=

 

Exclude from tables and output data sets all combinations of class variable values that are not in the CLASSDATA= data set

EXCLUSIVE

 

Consider missing values as valid values for class variables

MISSING

Control the statistical analysis

 

Specify the confidence level for the confidence limits

ALPHA=

 

Exclude observations with nonpositive weights

EXCLNPWGTS

 

Specify the sample size to use for the P 2 quantile estimation method

QMARKERS=

 

Specify the quantile estimation method

QMETHOD=

 

Specify the mathematical definition to calculate quantiles

QNTLDEF=

 

Specify the variance divisor

VARDEF=

Customize the appearance of the table

 

Specify a default format for each cell in the table

FORMAT=

 

Define the characters to use to construct the table outlines and dividers

FORMCHAR=

 

Eliminate horizontal separator lines from the row titles and the body of the table

NOSEPS

 

Order the values of a class variable according to the specified order

ORDER=

 

Specify the default style element or style elements (for the Output Delivery System) to use for each cell of the table

STYLE=

Options

ALPHA= value

CLASSDATA= SAS-data-set

CONTENTS= link-name

DATA= SAS-data-set

EXCLNPWGTS

EXCLUSIVE

FORMAT= format-name

FORMCHAR <( position(s) )>= formatting-character(s)

defines the characters to use for constructing the table outlines and dividers.

MISSING

NOSEPS

NOTHREADS

NOTRAP

ORDER=DATA FORMATTED FREQ UNFORMATTED

OUT= SAS-data-set

PCTLDEF=

QMARKERS= number

QMETHOD=OSP2HIST

QNTLDEF=12345

STYLE=< style-element-name PARENT>[ style-attribute-name = style-attribute-value < style-attribute-name = style-attribute-value >]

THREADS NOTHREADS

TRAP NOTRAP

VARDEF= divisor

BY Statement

Creates a separate table on a separate page for each BY group.

Main discussion: BY on page 58

BY <DESCENDING> variable-1

Required Arguments

variable

Options

DESCENDING

NOTSORTED

CLASS Statement

Identifies class variables for the table. Class variables determine the categories that PROC TABULATE uses to calculate statistics.

Tip: You can use multiple CLASS statements.

Tip: Some CLASS statement options are also available in the PROC TABULATE statement. They affect all CLASS variables rather than just the one(s) that you specify in a CLASS statement.

CLASS variable(s) </ option(s) >;

Required Arguments

variable(s)

Options

ASCENDING

DESCENDING

EXCLUSIVE

GROUPINTERNAL

MISSING

MLF

ORDER=DATA FORMATTED FREQ UNFORMATTED

PRELOADFMT

STYLE=< style-element-name PARENT>[ style-attribute-name = style-attribute-value < style-attribute-name = style-attribute-value >]

How PROC TABULATE Handles Missing Values for Class Variables

By default, if an observation contains a missing value for any class variable, then PROC TABULATE excludes that observation from all tables that it creates. CLASS statements apply to all TABLE statements in the PROC TABULATE step. Therefore, if you define a variable as a class variable, then PROC TABULATE omits observations that have missing values for that variable from every table even if the variable does not appear in the TABLE statement for one or more tables.

If you specify the MISSING option in the PROC TABULATE statement, then the procedure considers missing values as valid levels for all class variables. If you specify the MISSING option in a CLASS statement, then PROC TABULATE considers missing values as valid levels for the class variable(s) that are specified in that CLASS statement.

CLASSLEV Statement

Specifies a style element for class variable level value headings.

Restriction: This statement affects only the HTML, RTF, and Printer destinations.

CLASSLEV variable(s) / STYLE =< style-element-name PARENT>

Required Arguments

variable(s)

Options

STYLE=< style-element-name PARENT>[ style-attribute-name = style-attribute-value < style-attribute-name = style-attribute-value >]

FREQ Statement

Specifies a numeric variable that contains the frequency of each observation.

Tip: The effects of the FREQ and WEIGHT statements are similar except when calculating degrees of freedom.

See also: For an example that uses the FREQ statement, see FREQ on page 61.

FREQ variable ;

Required Arguments

variable

KEYLABEL Statement

Labels a keyword for the duration of the PROC TABULATE step. PROC TABULATE uses the label anywhere that the specified keyword would otherwise appear.

KEYLABEL keyword-1= description-1

Required Arguments

keyword

description

KEYWORD Statement

Specifies a style element for keyword headings.

Restriction: This statement affects only the HTML, RTF, and Printer output.

KEYWORD keyword(s) / STYLE =< style-element-name PARENT>

Required Arguments

keyword

Options

STYLE=< style-element-name PARENT>[ style-attribute-name = style-attribute-value < style-attribute-name = style-attribute-value >]

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 ,>

Required Arguments

column-expression

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=

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=

BOX= value

BOX={< label = value >

<STYLE=< style-element-name >[ style-attribute-name = style-attribute-value < style-attribute-name = style-attribute-value >]>}

CONDENSE

CONTENTS= link-name

FORMAT_PRECEDENCE=PAGEROWCOLUMNCOL

FUZZ= number

INDENT= number-of-spaces

MISSTEXT = text

MISSTEXT ={< label = text > < STYLE =< style-element-name >

NOCONTINUED

page-expression

PRINTMISS

ROW= spacing

row-expression

RTSPACE= number

STYLE=< style-element-name >[ style-attribute-name = style-attribute-value < style-attribute-name = style-attribute-value >]

STYLE_PRECEDENCE=PAGEROWCOLUMNCOL

Constructing Dimension Expressions

What Are 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 is composed of one or more elements and operators.

Elements That You Can Use in a Dimension Expression

labels

Region='Geographical Region' Sales*max='Largest Sale'

style-element specifications

Operators That You Can Use in a Dimension Expression

Specifying Style Elements in Dimension Expressions

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:

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.

For an example that shows how to specify style elements within dimension expressions, see Example 14 on page 1293.

VAR Statement

Identifies numeric variables to use as analysis variables.

Alias: VARIABLES

Tip: You can use multiple VAR statements.

VAR analysis-variable(s) </ option(s) >;

Required Arguments

analysis-variable(s);

Options

STYLE=< style-element-name PARENT>[ style-attribute-name = style-attribute-value < style-attribute-name = style-attribute-value >]

WEIGHT= weight-variable

WEIGHT Statement

Specifies weights for analysis variables in the statistical calculations.

See also: For information on calculating weighted statistics and for an example that uses the WEIGHT statement, see Calculating Weighted Statistics on page 64

WEIGHT variable ;

Required Arguments

variable

Категории