MAD Function

Returns the median absolute deviation from the median.

Category: Descriptive Statistics
Returned data type: DOUBLE

Syntax

Arguments

expression

specifies any valid expression that evaluates to a numeric value of which the median absolute deviation from the median is to be computed.

Data type DOUBLE

Details

If all arguments have missing or null values, the result is a missing or null value. Otherwise, the result is the median absolute deviation from the median of the nonmissing or non-null values. The formula for the median is the same as the one that is used in the UNIVARIATE procedure. For more information, see Base SAS Procedures Guide: Statistical Procedures.

Example

The following statement illustrates the MAD function:
Statements
Results
select mad(2, 4, 1, 3, 5, 999999);
1.5