Statalist


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

Re: st: How to create a rank?


From   "Jeremy Miles" <jeremy.miles@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: How to create a rank?
Date   Sun, 2 Mar 2008 20:49:35 -0800

How about :

gen revenue_reversed = revenue * -1
sort revenue_reversed
egen rank=group(revenue_reversed)

Jeremy



On 02/03/2008, Song <raravise@gmail.com> wrote:
> Dear Statalisters,
>
>  I am trying to create 'rank' based on total revenues. I used the following
>  command:
>
>  sort revenue
>  egen rank=group(revenue)
>
>  The result is that the smallest revenue is 1 and the highest revenue is 100,
>  for example. How can I reverse the rank? I want the highest revenue to be
>  number '1'.
>
>  Thank you,
>  Reo.
>
>  *
>  *   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/
>


-- 
Jeremy Miles
Learning statistics blog: www.jeremymiles.co.uk/learningstats
Psychology Research Methods Wiki: www.researchmethodsinpsychology.com
*
*   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