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: RE: how to transform variables again!


From   Nick Cox <[email protected]>
To   "'[email protected]'" <[email protected]>
Subject   st: RE: how to transform variables again!
Date   Tue, 15 Nov 2011 12:48:07 +0000

Answers were implied in both of the previous answers by Daniel Klein and myself. 

gen group1 = var1[1]
gen group2 = var2[1] 
drop in 1 
reshape long var group , i(code)
sort group code 

Now that you know that your problems are -reshape- after a little preparation, the next one is set as an exercise. 

Nick 
[email protected] 

econqian

      How to transform the original format of two variables to the new
format of two variables?
Original format
code	Var1	Var2
	4	8
1	54	89
2	87	28
3	39	75
4	99	96
5	119	100

New format
code	Va1	Var2
1	54	4
2	87	4
3	39	4
4	99	4
5	119	4
1	89	8
2	28	8
3	75	8
4	96	8
5	100	8


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