STAT Command

The STAT command totals the numeric elements contained in a specified attribute of a file. It also counts the number of items selected and averages the data contained in the attribute.

Format

STAT [DICT] filename [item-list] [attribute-name] [selection] [modifiers] [(options)]

Parameter(s)

DICT

Specifies the file dictionary.

filename

Name of the file.

item-list

List of individual item-IDs. Enclose each item-ID in single quotes.

attribute-name

Attribute that you want to sum. Refer to this attribute by its item-ID, as defined in the file dictionary.

selection

Specifies one or more conditions that an item must meet to be included in the total. For a complete description of selection expression syntax, see the LIST Command.

modifiers

Include one or more keywords that specify the report format. These parameters affect headers, footers, spacing, totalling column figures, control breaks, and more. For complete information about using these keywords, see the section, Connectives, Modifiers, and Options in the INFO/ACCESS User Reference Guide.

options

Include one or more single-character codes that specify the report format and direct or modify output. They must be enclosed in parentheses, can be entered in any order, and need not be separated by spaces or any delimiters such as commas. For complete information about using these parenthetical options, see the section, Connectives, Modifiers, and Options in the INFO/ACCESS User Reference Guide.

Description

The output of the STAT command is displayed in the following format:

STATISTICS OF item

TOTAL =  tot

AVERAGE =  avg

COUNT =  ct

Parameter(s)

item

Name of the attribute for which the statistics are produced.

tot

Total of the data values in the attribute.

avg

Total of the data values divided by the count.

ct

Number of items selected.

Producing a Total for a Numeric Attribute

To sum the attribute AMT-OVERDUE when it is greater than $50.00, enter the following:

>STAT ORDERS AMT-OVERDUE WITH AMT-OVERDUE > "50"

STATISTICS OF AMT-OVERDUE

TOTAL = $324,567.89

AVERAGE = $24966.7608

COUNT = 13