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 14:30:20 +0200

Hi

. separate var, by(time) gen(var_t)
. collapse var_t1-var_tn, by(id)

does the trick.

I found the solution in STATA help, but not in my darn expensive book "Statistics with STATA" by L.C. Hamilton.

Thanks for your help.

Best regards,
Sascha

Sascha Robert 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: 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