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: stack related (simple) problem


From   Nick Cox <[email protected]>
To   "'[email protected]'" <[email protected]>
Subject   st: RE: stack related (simple) problem
Date   Thu, 3 Mar 2011 19:53:17 +0000

Note that we can't comment on what you didn't understand if you don't show us any code. 

I wouldn't -stack- this. 

I would -reshape-. 

The main reason is that -reshape- is very useful, but you need to practise so that you can get used to it. I assume an identifier -id-. If one does not exist, create it. 

gen id = _n 

reshape long v, i(id) 

You can -stack- too. 

stack v1 v2 v3, into(v4) clear 

I don't understand why the duplicates in your first example don't show up in your second. I assume that's meaningless unless you explain to the contrary. 

Nick 
[email protected] 

Enayetur Raheem
 
I was trying to transform the following data 
 
v1 v2 v3 
11 12 13
11 12 13
11 12 13
21 22 23
21 22 23
21 22 23
31 32 33
31 32 33
31 32 33
 
into a single variable, such as 
 
v4
11
12
13
21
22
23
31
32
33

I tried the -stack - command, but could not get it done. I am very new
to Stata, so I am not aware of many commands. Any suggestion will be
much appreciated. 

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