MEDIAN inputVector resultVariable

Replaces the contents of the result variable with the median of the elements of the input vector. The median is the number for which one half the elements are above and half are below. If there is an even number of elements in the input vector, the median is the average of the two middle numbers. If the input vector has any missing data (represented by "." or "NaN"), they are removed before the median is calculated.

COPY 1,10 A
MEDIAN A median
PRINT A median

The above program produces the following output:

A: (1.0 2.0 3.0 4.0 5.0 6.0 7.0 8.0 9.0 10.0)
median: 5.5