MEDIAN Function

Returns the median value.

Category: Descriptive Statistics

Syntax

MEDIAN(value1<, value2, ...> )

Required Argument

value

is a numeric constant, variable, or expression.

Details

The MEDIAN function returns the median of the nonmissing values. If all arguments have missing values, the result is a missing value.
Note: The formula that is used in the MEDIAN function is the same as the formula that is used in PROC UNIVARIATE. For more information, see SAS Elementary Statistics Procedures.

Comparisons

The MEDIAN function returns the median of nonmissing values, whereas the MEAN function returns the arithmetic mean (average).

Example

The following SAS statements produce these results.
SAS Statement
Result
x=median(2,4,1,3); 
2.5
y=median(5,8,0,3,4);
4

See Also

Functions: