d = max(multiple_item ʃwhere conditionʅ);
The
max function returns the maximum value of an item that occurs multiple times.
During data entry, the result of the maximum calculation depends on where the statement is located. If the
max 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 maximum value up to the current occurrence number. If it is executed after the form or roster containing the item, it returns the maximum value for all occurrences of the item.
During batch editing, if the values of the items are not changed, the result of the maximum calculation is the same, no matter where the function is located. The function will return the maximum value for all occurrences of the item.
If a where condition is included, the function returns the maximum value of all occurrences for which the condition is true.
If any occurrence of the item is a special value (
default,
missing,
refused, or
notappl), the occurrence will not be included in the calculation. If all item occurrences are special values, then
default will be returned.
The function returns a decimal value.
MAX_INCOME = max(INCOME);
MAX_FEMALE_INCOME = max(INCOME where SEX = 2);