Bookmark and Share

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


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

st: sort within values


From   Michele Santacatterina <[email protected]>
To   [email protected]
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–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index