Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: reshaping data


From   Sascha Robert <sascha.robert@iew.unizh.ch>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: reshaping data
Date   Wed, 30 Mar 2005 15:46:46 +0200

Hi Nick

It's

. reshape wide var, i(id) j(time)

but don't ask me why right now... and thankyou anyway.

Regards,
Sascha

Nick Cox wrote:
Notwithstanding my earlier posting, this solution is just a long detour without the attraction of pleasant scenery.
. reshape long var, i(id) j(time)
Nick n.j.cox@durham.ac.uk
Christian Hunkler


there might be smarter solutions, but why don't you just separate the data
into different files, e.g.
use data
drop if time==1
save datatime1

use data
drop if time==2
rename variables ...
sava datatime2

and then merge it using your id variable... (see -help merge- for this).

At 12:04 30.03.2005, you wrote:


Hello

I would like to reshape some data. Now it looks something like this:

id    time    var
1     1       x
2     1       y
1     2       z
2     2       w

I would like to change it to

id    var_t1    var_t2
1     x         z
2     y         w


*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/


--
***** sascha robert | mailto: sascha.robert@iew.unizh.ch *****
*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index