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 at the end of May, and its replacement, statalist.org 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" <Laura.Grigolon@econ.kuleuven.be>
To   "statalist@hsphsun2.harvard.edu" <statalist@hsphsun2.harvard.edu>
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 (http://www.stata.com/support/faqs/lang/sort.html), 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,
Laura

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/


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