Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Create a rank variable

    mpg rank
    12 1
    12 1
    14 2
    14 2
    14 2
    15 3
    15 3
    16 4
    17 5
    I want to create a rank like the one in the table above. I tried using the default rank command. None of the commands gives me the above ranking.

  • #2
    I guess you're referring to the rank functionality of egen. You're correct that egen doesn't regard this numbering as a kind of ranking. The essence of ranking is to count how many observations have higher or lower values, and this method fails at showing that except in some limiting cases.

    That said, you should consider

    Code:
    egen rank = group(mpg)
    as a way to get what you want.

    Comment


    • #3
      This is exactly what I need! Thanks a lot!

      Comment

      Working...
      X