Statalist The Stata Listserver

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

st: -egen rank ()

From   "Nikolaos A. Patsopoulos" <>
Subject   st: -egen rank ()
Date   Thu, 21 Sep 2006 16:50:00 +0300


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,


* For searches and help try:

© Copyright 1996–2022 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index