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

Re: st: reshaping data


From   Jean-Benoit Hardouin <[email protected]>
To   [email protected]
Subject   Re: st: reshaping data
Date   Wed, 30 Mar 2005 14:21:09 +0200

The smarter solution is :
. reshape wide var,i(id) j(time)
You obtain two variables var1 and var2 to easy to rename var_t1 and var_t2

Jean-Benoit Hardouin

Christian Hunkler a �crit :

Hi Sascha,

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).

Best,
Chris

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

Any hints?

Kind regards,
Sascha

--
***** sascha robert | mailto: [email protected] *****
*
* 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/





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



--
*********************************************
Jean-Benoit Hardouin
Biostatisticien
Observatoire R�gional de la Sant� du Centre
BP 2439
1, rue Porte Madeleine
45032 Orl�ans Cedex 1
t�l : 02 38 74 48 80
fax : 02 38 74 42 36
Email : [email protected]
*********************************************

*
*   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–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index