Statalist The Stata Listserver


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: -egen rank ()


From   Jeph Herrin <junk@spandrel.net>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: -egen rank ()
Date   Thu, 21 Sep 2006 10:08:17 -0400

Did you try the /track/ option?

Nikolaos A. Patsopoulos wrote:
Hi,

I want to create a variable containing the rank order of another one but I cannot make tie corrections:

the data:

v6 countMain aaa 374
bbb 213 ccc 204 gvfdg 193
gfdg 170
gfdh 166

I use egen rankMain=rank( countMain) if counter_v6==1, field #counter_v6 is a _n variable for v6

if I don't use the /field/ parameter I get the reverse order of that I want, e.g. aaa gets a rank of 4880 instead of 1. However using field doesn't correct for ties (want to use the average for ties).

Any suggestions?

Thanks in advance,

Nikos

*
* 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