Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: RE: rank error?


From   "Sorbero, Melony" <msorbero@rand.org>
To   "'statalist@hsphsun2.harvard.edu'" <statalist@hsphsun2.harvard.edu>
Subject   st: RE: rank error?
Date   Tue, 27 May 2003 18:32:51 -0400

Jeph,
Based on your table, it looks like ties are included in determining the next
value in the ranking. You have 5 observations tied with a rank of 1, so the
next ranking that appears is 6, and so on. 
Best,
Melony

Melony E. S. Sorbero, PhD, MPH
RAND
201 North Craig Street
Pittsburgh, PA 15213
412-683-2300 ext. 4628

-----Original Message-----
From: Jeph Herrin [mailto:herrin@flyingbuttress.net]
Sent: Tuesday, May 27, 2003 6:19 PM
To: statalist
Subject: st: rank error?


Hi all,

According to the documentation, egen's -rank- function should,
with -field- or -track- switches, give me consecutive ranks. Yet
when I try:

. egen rank=rank(var1), track

I get non-consecutive ranks:

. tab rank

  track rank |
  of (beta1) |      Freq.     Percent        Cum.
------------+-----------------------------------
           1 |          5        0.83        0.83
           6 |          5        0.83        1.66
          11 |          6        1.00        2.66
          17 |          8        1.33        3.99
          25 |          8        1.33        5.32
          33 |          4        0.67        5.99
          .
          .
          .

I've been looking at this for half an hour and finally figured
either there's something wrong with egen's rank, or there's something
wrong with me.

Any opinions?

cheers,
Jeph
--
Jeph Herrin
herrin@flyingbuttress.net

*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/
*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   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   |   What's new   |   Site index