Page 1 of 1

stack/unstack data

Posted: Mon Aug 03, 2015 10:00 am
by jdubas
I have an excel spreadsheet (downloaded from the not-so-versatile IMF) organized with country, year and data series all in rows. I can't seem to convert it into a proper panel data, in which the country and year are in rows but the data value is in columns.

for instance:
Country | Year| Data Series ID | Value
A | 1990| NGDP| 130283
A | 1991| NGDP| 920912
A | 1990| CPI | 102
A | 1991| CPI| 132
A | 1990| TOT| 103
A | 1991| TOT| 105

ought to look like:

Country| Year| Data series ID1 (NGDP) | Data series ID2 (CPI)| Data series ID3 (TOT)
A | 1990 | 130283 | 102 | 103
A | 1991 | 920912 | 132 | 105

This is for more than just 1 country--I just did one to illustrate the current structure of the database. Thanks in advance for any help you can provide.

Re: stack/unstack data

Posted: Mon Aug 03, 2015 12:37 pm
by EViews Gareth
Not quite sure where EViews comes in to play. The example you give is perfect panel data to begin with (at least as far as EViews is concerned).

Re: stack/unstack data

Posted: Mon Aug 03, 2015 1:20 pm
by jdubas
It leaves me with a series called "Value", which contains around 35 different variables. These 35 should be the series. I can't do anything with a series that mashes together all of these variables. Suggestions?

Re: stack/unstack data

Posted: Mon Aug 03, 2015 1:40 pm
by EViews Glenn
I think this will work...

In the workfile window menu select Proc/Reshape Current Page/Unstack in New Page....

The unstacking identifier is the data series ID. The observation identifiers are both the cross-section identifier and the period identifier.

You'll need to do some massaging of the series names on the output page.