stack/unstack data

For questions regarding the import, export and manipulation of data in EViews, including graphing and basic statistics.

Moderators: EViews Gareth, EViews Steve, EViews Moderator, EViews Jason

jdubas
Posts: 2
Joined: Mon Aug 03, 2015 9:50 am

stack/unstack data

Postby jdubas » Mon Aug 03, 2015 10:00 am

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.

EViews Gareth
Fe ddaethom, fe welon, fe amcangyfrifon
Posts: 13603
Joined: Tue Sep 16, 2008 5:38 pm

Re: stack/unstack data

Postby EViews Gareth » Mon Aug 03, 2015 12:37 pm

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).

jdubas
Posts: 2
Joined: Mon Aug 03, 2015 9:50 am

Re: stack/unstack data

Postby jdubas » Mon Aug 03, 2015 1:20 pm

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?

EViews Glenn
EViews Developer
Posts: 2682
Joined: Wed Oct 15, 2008 9:17 am

Re: stack/unstack data

Postby EViews Glenn » Mon Aug 03, 2015 1:40 pm

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.


Return to “Data Manipulation”

Who is online

Users browsing this forum: No registered users and 2 guests