Page 1 of 1

Simple pageunstack gone wrong

Posted: Fri May 29, 2026 9:46 pm
by paues
I want to import the attached (minimal) text files and unstack them into dated pages with two series: a and b. The text files differ with respect to the value column. The first file (test.txt) has variation in both the name and time dimension (i.e. all unique values), the second (test2.txt) has variation in the name dimension and the third (test3.txt) has variation in the time dimension.

test.txt

Code: Select all

name period value a 2000 1 a 2001 2 b 2000 3 b 2001 4
test2.txt

Code: Select all

name period value a 2000 1 a 2001 1 b 2000 2 b 2001 2
test3.txt

Code: Select all

name period value a 2000 1 a 2001 2 b 2000 1 b 2001 2

I thought that the following two steps would have worked for all the files.

First load the page and unstack it

Code: Select all

pageload .\test.txt pageunstack name dateid @ value
to get the series valuea and valueb (as well as a series dateid, a pool name and a group value) and then do some cleanup

Code: Select all

delete name value dateid rename value* *
And this does work for the first two files, test.txt and test2.txt. But for test3.txt the first step doesn't create the series valuea and valueb (nor the group value) but instead a single series value. And then the second step naturally results in an empty page (albeit correctly dated).

What to do?

Re: Simple pageunstack gone wrong

Posted: Fri May 29, 2026 11:17 pm
by EViews Gareth
The issue is that because there is no between cross-section variation (a and b are identical), when you stack, EViews does the "smart" thing in realising you don't need two different value series, so it condenses down to a single series, called value. Then when you do the tidyup step, you delete it.

Really the only way around this is to test whether there are any series called VALUE[X] before doing the tidyup.

Re: Simple pageunstack gone wrong

Posted: Sat May 30, 2026 2:17 am
by paues
And then loop over the pool name and create the missing series? Something like this:

Code: Select all

pageload .\test.txt pageunstack name dateid @ value if @isempty(@wlookup("value", "group")) then %crossids = name.@crossids for %crossid {%crossids} copy value value{%crossid} next endif delete name value dateid rename value* *

Re: Simple pageunstack gone wrong

Posted: Sat May 30, 2026 6:00 am
by EViews Gareth
Yeah, that’s not a bad way to do it.