Calculate the average of specified numeric expressions
AVERAGE [<scope>] <expN1> [, <expN2> ...]
[TO <memvar-list> | TO ARRAY <array name>]
The AVERAGE command calculates the arithmetic mean of all the specified numeric expressions. All records in the currently selected table are averaged unless the <scope> is specified.
If the FOR clause is specified, then only those records matching the specified <condition> are averaged.
The WHILE is used to restrict the range of records processed while the specified <condition> is true. When used in conjunction with the SEEK or LOCATE commands, it gives a quick way of averaging selected records. When the WHILE clause is used, the <scope> will default to REST unless otherwise specified.
If TO <memvar> is specified then the result of AVERAGE will be stored in the specified memory variable. If the variable does not exist it will be created.
TO ARRAY <array>
The TO ARRAY clause is used to store results in a pre-defined one-dimensional array. The result of the first numeric expression is placed in the first array element, the second result is placed in the second element, and so on. If there are fewer elements than expressions, the AVERAGE command will only store results for which there are elements. If there are more elements than expressions, the remaining elements are left empty.
use patrons average seats, cost; to avg_seats, avg_cost; for event = "PHANTOM"