Topic group Related topics Example
Computes the arithmetic mean (average) of specified numeric fields in the current table.
AVERAGE [<exp list>]
[FOR <condition 1>]
[WHILE <condition 2>]
[TO <memvar list> | TO ARRAY <array>]
The numeric fields, or expressions involving numeric fields, to average.
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.
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.
Loop through the rowset to calculate the average.