Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down on April 23, and its replacement, is already up and running.

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

st: Issue on sorting on categorical variables

From   "Grigolon, Laura" <>
To   "" <>
Subject   st: Issue on sorting on categorical variables
Date   Wed, 1 Jun 2011 13:14:22 +0000

Dear Statalisters,
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.
Thank you for your help,

*   For searches and help try:

© Copyright 1996–2015 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index