An updated version of astile is now available on SSC. To update your copy, please type:
ssc install astile, replace
This version fixes a minor bug that existed when bysort prefix was used with if condition.


astile is a faster and byable alternative for xtile. astile creates a new variable that categorizes exp by its quantiles. astile is faster than Stata official xtile. It's speed efficiency matters more in larger data sets or when the quantile categories are created multiple times, e.g, we might want to create portfolios in each year or each month. Also, unlike Stata's official xtile, astile is byable. astile handles groupwise calculations super efficiently. For example, the difference in time when used with bys and without bys is usually few seconds in a million observations and 1000 groups.