I don't know why you think -recode- is relevant
here. Typing
. search rank
will point you towards the -egen- function -rank()-.
. egen rank = rank(var), by(time) field
may well be adequate for your purpose. You might need to
think about what you want if any ties occur.
Nick
[email protected]
Sascha Robert
> I applogize for this newbie question in advance.
> My data looking like this
>
> time id var
> 1 1 19.5
> 1 2 20.7
> 1 3 15.0
> 2 1 16.5
> 2 2 21.7
> 2 3 17.0
> ...
>
> Now I would like to generate a variable 'rank' for each value
> of 'time'
> representing the ordinal number of th value 'var':
>
> time id var rank
> 1 1 19.5 2
> 1 2 20.7 1
> 1 3 15.0 3
> 2 1 16.5 3
> 2 2 21.7 1
> 2 3 17.0 2
> ...
>
> . recode does not seem to work, because 'var' changes to a
> great extent over time.
*
* 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/