Page 1 of 1

Reshape Worldbank dataset from wide to long

Posted: Tue Jan 31, 2023 12:40 am
by binhpham79
Hi Eviews users,

I have a dataset downloaded from the WB like this.
wb_panel_sample.xlsx
(9.95 KiB) Downloaded 2007 times
I have tried to reshape to the standard long panel as usual by stacking the _? year columns but I cannot spread the multiple series and their associated values as can be easily done in R.

Please guide me with a suggestion.

Thanks!

Re: Reshape Worldbank dataset from wide to long

Posted: Tue Jan 31, 2023 10:12 am
by EViews Gareth

Code: Select all

close @wf wfopen wb_panel_sample.xlsx colhead=1 pagestruct(none) pagestack num? @ *? * alpha sername = @makevalidname(indicators) d id01 pageunstack sername var01 iso3 d indicators* sername num pagestruct @date(var01) iso3 rename num* * d var01

Re: Reshape Worldbank dataset from wide to long

Posted: Tue Jan 31, 2023 9:23 pm
by binhpham79
Thanks, Gareth. It works perfectly! :))