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 rows and give variable name of the observation


From   Haluk Vahaboglu <[email protected]>
To   "[email protected]" <[email protected]>
Subject   st: Sort rows and give variable name of the observation
Date   Thu, 21 Nov 2013 06:19:39 +0000

P { margin-bottom: 0.21cm; }


Dear Stata listers,
Apologize taking your time
with this simple question.
I use Stata 12.1 64 for
linux.
I have a set of variables
coded binary as 1/0 and an ID variable:
ID x y z
1 1 0 0
2 0 1 0
3 0 0 1
I want to search row-wise
and find out the first occurrence of -1- to generate a new string
variable displaying variable name of that obs. 

In the end I hope to get a
variable like this:
ID x y z W
1 1 0 0 x
2 0 1 0 y
3 0 0 1 y
This problem could be
solved by giving the variable name instead of the value of the obs.
to the output of -rowsort- (by Nicholas J. Cox available in ssc)
command, may be, but I could not figure out.
Any help would be
appreciated.



Prof. Dr. Haluk Vahaboğlu 		 	   		  

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


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