d = average(multiple_item ʃwhere conditionʅ);
function returns the average of multiple_item
, an item that occurs multiple times. During data entry, the result of the average calculation depends on where the statement is located. If the function is executed prior to the form or roster containing the item, it returns default
. If it is executed within the form or roster containing the item, it returns the average up to the current occurrence number. If it is executed after the form or roster containing the item, it returns the average for all occurrences of the item.
During batch editing, the function returns the average value for all occurrences of the item, regardless of the statement's placement in the program.
If a where condition is included, the function returns the average of the occurrences for which condition is true.
If the value of an occurrence of the item is a special value
, the occurrence will not be included in the calculation. If none of the occurrences have values other than special values, default
The function returns the decimal value of the average.
AVG_INCOME = average(INCOME);
AVG_FEMALE_INCOME = average(INCOME where SEX = 2);