Hi, Kit your procedure for my reshape problem works almost perfect, the
thing is that my descriptor usually is a very long string such as "Total
factor Productivity" and when i do
. reshape wide d,i(cty year) j(var) string
i'll lose my variables column as i get:
(note: j = Total factor productivity Volume of non-oil imports)
(note: no data for descriptor == Total)
(note: no data for descriptor == factor)
(note: no data for descriptor == productivity)
I ended up with only country year columns.
The second problem is that the number of series is very large (about 170)
and most of them are not available for all countries, which make coding
very messy. I'd really appreciate your help on this,
thank you
ALejandro
-----Original Message-----
From: baum [mailto:[email protected]]
Sent: Tuesday, September 17, 2002 8:28 AM
To: [email protected]
Subject: st: Re: reshape
--On Tuesday, September 17, 2002 2:33 -0400 Alejandro wrote:
Hi, i have the a database like this:
country descriptor year1970 year1971 ... year2000
Argentina var1 x70 x71 x00
Argentina var2 y70 y71 y00
Bolivia var1 x70 x71
x00 Bolivia var2 y70 y71
y00 .
.
.
and so on... i want to know if exists a way in which i could reshape this
wide dataset into a long one that would look like this:
country year var1 var2
Argentina 1970 x70 y70
Argentina 1971 x71 y71
.
.
.
do you know how could i do the reshape of the two variables jointly ? if
i use the <reshape> command i'd have to do it one by one.
. list
cty var d1970 d1971 d1972
1. arg var1 1970 1971 1972
2. arg var2 2070 2071 2072
3. bol var1 2170 2171 2172
4. bol var2 2270 2271 2272
. reshape long d ,i(cty var)
. rename _j year
. reshape wide d,i(cty year) j(var) string
. list
cty year dvar1 dvar2
1. arg 1970 1970 2070
2. arg 1971 1971 2071
3. arg 1972 1972 2072
4. bol 1970 2170 2270
5. bol 1971 2171 2271
6. bol 1972 2172 2272
There is always a way to do it with reshape. The difficulty is figuring
out how!
Kit
*
* 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/