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: RE: stack related (simple) problem
From
"Enayetur Raheem" <[email protected]>
To
<[email protected]>
Subject
st: RE: RE: stack related (simple) problem
Date
Thu, 3 Mar 2011 15:42:48 -0500
Thanks a lot, Nick. The duplicates do not show up in the transformed
data, and that is why I was having trouble reshaping it (as I was not
getting the desired results).
I guess, I will use some sort of loops to delete the duplicate rows from
the first example, and then apply -reshape-.
-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Nick Cox
Sent: March-03-11 2:53 PM
To: '[email protected]'
Subject: st: RE: stack related (simple) problem
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/
*
* 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/