ANS85 

The MEDIAN Function

The MEDIAN function returns the content of the argument whose value is the middle value in the list formed by arranging the arguments in sorted order. The type of this function is numeric.

General Format


*

Arguments

  1. Argument-1 must be class numeric.

Returned Values

  1. The returned value is the content of the argument-1 having the middle value in the list formed by arranging all the argument-1 values in sorted order.
  2. If the number of occurrences referenced by argument-1 is odd, the returned value is such that at least half of the occurrences referenced by argument-1 are greater than or equal to the returned value and at least half are less than or equal. If the number of occurrences referenced by argument-1 is even, the returned value is the arithmetic mean of the values referenced by the two middle occurrences.
  3. The comparisons used to arrange the argument-1 values in sorted order are made according to the rules for relation conditions. See the topic Relation Condition in the chapter Procedure Division.
  4. Floating-point format is used for numeric non-integer results.