Computes the arithmetic mean (average) of specified numeric fields in the current table.

Syntax

AVERAGE [<exp list>]
[<scope>]
[FOR <condition 1>]
[WHILE <condition 2>]
[TO <memvar list> | TO ARRAY <array>]

<exp list>

The numeric fields, or expressions involving numeric fields, to average.

<scope>
FOR <condition 1>
WHILE <condition 2>

The scope of the command. The default scope is ALL.

TO <memvar list> | TO ARRAY <array>

Initializes and stores averages to the variables (or properties) of <memvar list> or stores averages to the existing array <array>. If you specify an array, each field average is stored to elements in the order in which you specify the fields in <exp list>. If you don't specify <exp list>, each field average is stored in field order. <array> can be a single- or multidimensional array; the array elements are accessed via their element numbers, not their subscripts.

Description

The AVERAGE command computes the arithmetic means (averages) of numeric expressions and stores the results in specified variables or array elements. If you store the values in variables, the number of variables must be exactly the same as the number of fields or expressions averaged. If you store the values in an array, the array must already exist, and the array must contain at least as many elements as the number of averaged expressions.

If SET TALK is ON, AVERAGE also displays its results in the results pane of the Command window. The SET DECIMALS setting determines the number of decimal places that AVERAGE displays. Numeric fields in blank records are evaluated as zero. To exclude blank records, use the ISBLANK( ) function in defining a FOR condition. EMPTY( ) excludes records in which a specified expression is either 0 or blank.

OODML

Loop through the rowset to calculate the average.