*! version 1.0 01aug2014

Title

xtine -- Calculate percentile and quantile for a numeric variable.

Syntax

xtine varlist [if] [in], nq(integer)

nq number of quantiles (integer)

by is not allowed
fweights are not allowed

Description

xtine is used to generate two variables, one containing percentile and the other containing quantile. The new percentile variables end with the suffix *_pctile, and the quantile variables end with the suffix *_[nq]. Xtine is similar to STATA's xtile command, but is able to make more evenly distributed quantiles.

Remarks

The number of quantiles must be specified.

The formula used to calculate percentile is as follows:
percentile=(([count below]+(.5*[count equal]))/[count])*100

Examples

. xtine gre_score satm, nq(5)

. xtine gre_score satm if gender==”M”, nq(3)

Author

Christine Cook. West Point, NY