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

Re: st: Transpose?


From   "Dimitriy V. Masterov" <[email protected]>
To   [email protected]
Subject   Re: st: Transpose?
Date   Tue, 13 Apr 2004 19:01:18 -0500 (CDT)

Justin,

I will elaborate on the suggestions provided by the others. I think you
want to use a 2-step reshape:

reshape long country, i(year series) j(country_num)
reshape wide country, i(year country_num) j(series)

I believe that this will work if your series variable is coded numerically
(i.e., as 1 or 2). These 2 commands will take the data:

****************************************************************************
year	series	country1	country2	country3	country4
1960	1	26	28	72	97
1960	2	4	12	70	22
1961	1	42	41	23	26
1961	2	90	72	10	17
1962	1	52	87	59	76
1962	2	84	46	35	37
1963	1	21	42	81	38
1963	2	56	89	10	97
1964	1	26	6	58	58
1964	2	95	68	11	80
******************************************************************************

and make it into this:

*********************************************************
year	country_num	country1	country2
1960	1	26	4
1960	2	28	12
1960	3	72	70
1960	4	97	22
1961	1	42	90
1961	2	41	72
1961	3	23	10
1961	4	26	17
1962	1	52	84
1962	2	87	46
1962	3	59	35
1962	4	76	37
1963	1	21	56
1963	2	42	89
1963	3	81	10
1963	4	38	97
1964	1	26	95
1964	2	6	68
1964	3	58	11
1964	4	58	80
**********************************************************

I hope that helps.

DVM


_______________________________________________________________________________
Dimitriy V. Masterov

Work:
Center for Social Program Evaluation
1155 East 60th St. Room 038
Chicago, IL 60637
Work: (773)256-6005
Fax: (773)256-6313

Home:
1312 East 53rd St., Apt.309
Chicago, IL 60615
Mobile: (773)220-2760




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