The QNTL subroutine computes sample quantiles for data. The arguments are as follows:
specifies a matrix to contain the quantiles of the x matrix.
specifies an numerical matrix of data. The QNTL subroutine computes quantiles for each column of the matrix.
specifies a numeric vector of probabilities used to compute the quantiles. If this option is not specified, the vector is used, resulting in the quartiles of the data. For convenience, a probability of 0 returns the minimum value of x, and a probability of 1 returns the maximum value.
specifies the method used to compute the quantiles. These methods correspond to those defined by using the PCTLDEF= option in the UNIVARIATE procedure. For details, see the section “Calculating Percentiles” of the documentation for the CORR procedure in the Base SAS Procedures Guide: Statistical Procedures.
The following values are valid:
specifies that quantiles are computed according to a weighted average.
specifies that quantiles are computed by choosing an observation closest to some quantity.
specifies that quantiles are computed by using the empirical distribution function.
specifies that quantiles are computed according to a different weighted average.
specifies that quantiles are computed by using average values of the empirical distribution function. This is the default value.
If x is an matrix, the QNTL subroutine computes a matrix where is the dimension of the probs matrix. The quantiles are returned in the q matrix, as shown in the following example:
x = {5 1 10, 6 2 3, 6 8 5, 6 7 9, 7 2 13}; call qntl(q, x); print q[rowname={"P25", "P50", "P75"}];
You can use the MATTRIB statement to permanently assign row names to the matrix that contains the quantiles, as shown in the following statements:
p = {0.25 0.50 0.75}; labels = "P" + strip(putn(100*p, "best5.")); mattrib q rowname=labels; print q;
You can specify the optional arguments in either of two ways: by specifying an argument positionally or by specifying a keyword/value pair, as shown in the following statements.
x = T(1:100); p = do(0.1, 0.9, 0.1); call qntl(q1, x, p); call qntl(q2, x) probs=p; /* equivalent */