Statalist The Stata Listserver


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: Re: panel data management: columns to rows


From   "Michael Blasnik" <[email protected]>
To   <[email protected]>
Subject   st: Re: panel data management: columns to rows
Date   Tue, 13 Jun 2006 13:15:56 -0400

see -help reshape-. Something like:

reshape wide var1 var2 var3, i(date) j(id)

should be a good start. You can then save the wide dataset and then keep just the sets of variables you want and outsheet them.

Michael Blasnik
[email protected]

----- Original Message ----- From: "Krishna Naidoo" <[email protected]>
To: <[email protected]>
Sent: Tuesday, June 13, 2006 1:09 PM
Subject: st: panel data management: columns to rows



I have a simple question about rearranging my
(balanced) panel dataset. It is currently in the form:

date         id       var1    var2    var3
1996q1       1         56      37      83
1996q1       2         67      44      77
1996q1       3         55      67      90
1996q2       1         36      45      88
1996q2       2         68      41      92
...
2005q4       3         73      85      67

I would like to obtain separate blocks of data, one
for each variable, with either the date in columns and
id in rows or the other way around. Ultimately I need
to export this from Stata into excel into separate
spreadsheets, one each for var1 var2 etc, that look
like (of course with the relevan values in):

            id1    id2    id3
1996q1
1996q2
1996q3
...
2005q4

Or with dates and ids the otheer way around would be
fine too. I've been trying to do this with tabstat
manually and copy and past out but it is extremely
time consuming as I have a large dataset. Any
suggestions as to how to do this efficiently would be
appreciated.

Yours,
Krishna
*
*   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