Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down on April 23, and its replacement, statalist.org is already up and running.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: RE: xtile command for calculating tertiles


From   Nick Cox <n.j.cox@durham.ac.uk>
To   "'statalist@hsphsun2.harvard.edu'" <statalist@hsphsun2.harvard.edu>
Subject   st: RE: xtile command for calculating tertiles
Date   Sun, 24 Oct 2010 18:01:55 +0100

Answering this well is possible only to a very small number of people using both Stata and SAS; I am not among them. You'd get a good answer faster with either or both of 

1. Results from the same test data containing ties administered to both programs. For example, the numbers 1/29 30 repeated 10 times 40/100. 

2. An explanation of what exactly SAS does, in this case, gleaned by looking at its code or its documentation. 

There is a literature explaining that different programs use one or more of about ten different recipes for quantiles, for example 

Hyndman, R.J. and Y. Fan. 1996. Sample quantiles in statistical packages. The American Statistician 50: 361--365. 

Nick 
n.j.cox@durham.ac.uk 

Weichle, Thomas

Can anyone comment on the difference between the way Stata's -xtile-
command creates tertiles compared to the way the SAS -proc rank- creates
tertiles? And the differences in which ties are handled?  The following
are the code I'm using and I am getting slightly different results.  My
data do contain ties and I think this is the issue.

Stata:
xtile tertile = opcd, nquantiles(3)

SAS:
proc rank data = test out = ranks groups = 3;
	var opcd;
	ranks opcd_tert;
	run;


*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index