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, statalist.org is already up and running.


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

st: sort within values


From   Michele Santacatterina <miksanta@hotmail.it>
To   statalist@hsphsun2.harvard.edu
Subject   st: sort within values
Date   Wed, 26 Sep 2012 10:19:52 +0200

Dear Stat Users,

i was wondering how to sort a numeric variable within the values. Here an example, var1 contains 2 values (12,21) i would like to sort within var1 in order to create var2 = (12,12)

var1 var2
12	12
12	12
12	12
12	12
21	12
21	12
21	12
21	12

furthermore i have the same question for a string variable, for example if i have var1 (A+E , E+A) i would like to create a var2 (A+E,A+E). 

var1	var2
A+E		A+E
A+E		A+E
E+A		A+E
E+A		A+E


any ideas?

Thank you.


*
*   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