Your Browser is not longer supported

Please use Google Chrome, Mozilla Firefox or Microsoft Edge to view the page correctly
Loading...

{{viewport.spaceProperty.prod}}

MEAN - Arithmetic mean of arguments

The MEAN function returns a numeric value that is the arithmetic mean (average) of its arguments.
The type of this function is numeric.

Format


FUNCTION MEAN ({argument-1}...)


Argument

  1. argument-1 must be class "numeric".

Returned values

  1. The returned value is the arithmetic mean of the argument series.

  2. The returned value is defined as the sum of the argument series divided by the number of arguments specified.

  3. The error default value is 0.


See also:
        MIN, MAX, RANGE, MEDIAN, MIDRANGE, SUM

Example 9-25

...
DATA DIVISION.
WORKING-STORAGE SECTION.
01  R PIC 999V999.
01  RES PIC 999.999.
PROCEDURE DIVISION.
P1 SECTION.
MAIN.
    COMPUTE R = FUNCTION MEAN (12 32 5 8 17 9).
    MOVE R TO RES.
    DISPLAY RES UPON T.
    STOP RUN.

Result:               013.833