Statalist The Stata Listserver


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

st: fraction ranking


From   Ana Guerrero Serdan <[email protected]>
To   [email protected]
Subject   st: fraction ranking
Date   Wed, 6 Dec 2006 09:42:37 +0000 (GMT)

Hi,

   I have stata 9.1 and Im trying to do a fractional ranking of a
discrete variable (x) with three values (1,2,3).

   Im using the following commands:

   sort x
   egen n=count(x)
   gen order=_n
   by x: egen i=rank(order)
   gen y=i/n

   I somehow dont get values for y in a fractional way? any ideas where
Im doing wrong?

   thanks

*
*   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–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index