Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: st: Issue on sorting on categorical variables

From   Nick Cox <>
To   "" <>
Subject   Re: st: Issue on sorting on categorical variables
Date   Wed, 1 Jun 2011 14:26:12 +0100

If you still have the variable -id- and have not changed it then such commands should be repeatable; otherwise things are not in your favour.


<> wrote:

I have an issue about sorting on categorical variables.
I sorted on a variable that does not have unique values for every observation in the data and subsequently I referred to the order within the group by generating a variable id = _n. I then used the id number to replace values (such as: replace variable = 10 if id==100). I realize that my approach is wrong, as explained in the FAQ ( ), since Stata does not keep the same ordering. However, since I implemented a huge amount of modifications, I was wondering if there is a way to be able to run the do file again and obtain the same results.
*   For searches and help try:

© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index