Language Reference


QUARTILE Function

QUARTILE (matrix);

The QUARTILE function is part of the IMLMLIB library . Given an $n \times m$ data matrix, the QUARTILE function returns a $5 \times m$ matrix. The rows of the return matrix contain the minimum, lower quartile, median, upper quartile, and maximum values (respectively) for the data in matrix. Missing values are excluded from the computation. If all values in a column are missing, the return values for that column are missing.

use sashelp.class;
read all var _NUM_ into X[colname=varNames];
close sashelp.class;
q = quartile(X);
rn = {"Minimum" "Q1" "Median" "Q2" "Maximum"};
print q[rowname=rn colname=varNames];

Figure 25.297: Quartiles

q
  Age Height Weight
Minimum 11 51.3 50.5
Q1 12 57.5 84
Median 13 62.8 99.5
Q2 15 66.5 112.5
Maximum 16 72 150



For the computation of arbitrary quantiles, see the documentation for the QNTL call .