QUANTILE procedure
Calculates quantiles of the values in a variate (P.W. Lane).
Options
Parameters
Description
Quantiles are statistics that characterize the distribution of a sample of numbers. A quantile q of a sample {xi, i=1...n} can be formed for any proportion p in the range [0,1], and has the following properties:
1) at least the proportion p/n of {xi} are less than or equal to q;
2) at least the proportion (1-p)/n of {xi} are greater than or equal to q;
3) if q=xi and q=xi+1 satisfy 1) and 2), then take q = (xi+xi+1)/2.
Thus the quantile for proportion 0.5 is the median; for 0.0 it is the minimum and for 1.0 the maximum of the sample. By default, QUANTILE produces the five quantiles called the "five-number summary" of a sample, corresponding to the proportions 0.0, 0.25, 0.5, 0.75, 1.0. The option PROPORTION can be set to a scalar or variate to request other single quantiles or sets of quantiles. By default, QUANTILE prints the statistics, but this can be suppressed by setting option PRINT=*. The quantiles can be stored in a variate using the parameter QUANTILES.
Options: PRINT, PROPORTION. Parameters: DATA, QUANTILES.
Method
First, the values are sorted into ascending order. Then for each proportion, the two values that are candidates for the quantile are found, by counting from either end of the sorted list to leave the required number of values from that point in the list to the end. The quantiles are the means of the two values found.
Action with
RESTRICT
If the DATA variate is restricted, the quantiles are formed only using the units that are not restricted out. The PROPORTION and QUANTILES variates must not be restricted.