Recoding alpha series to allow panel unstacking

For questions regarding programming in the EViews programming language.

Moderators: EViews Gareth, EViews Jason, EViews Moderator, EViews Matt

rjoharanz
Posts: 2
Joined: Mon Dec 20, 2021 5:00 pm

Recoding alpha series to allow panel unstacking

Postby rjoharanz » Tue Dec 21, 2021 6:56 pm

Hi,

I'm trying to unstack a panel workfile page, but one of the identifier series (area) contains spaces and special characters, which EViews 11 (12 November 2019 build) does not allow.

I could recode each element of the series individually, as below, but I'm hoping there is a more efficient way.

Code: Select all

alpha area_
area_ = @recode(area="Hawke's Bay","Hawke_s_Bay",area)


I thought I could run the FOR loop below, but the string command doesn't work as the {%y} in the loop don't have quotes around them. Double quotes don't seem to work either.

Code: Select all

for %y "Bay of Plenty" "Manawatu-Wanganui" "West Coast"
string a = {%y}
string b = @makevalidname(a)
area_ = @recode(area_={%y},b,area_)
delete a b
next


Any suggestions will be much appreciated.

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

Re: Recoding alpha series to allow panel unstacking

Postby EViews Gareth » Tue Dec 21, 2021 7:56 pm

Code: Select all

alpha area_ = @makevalidname(area)

:D

(we should document that function...)
Follow us on Twitter @IHSEViews

rjoharanz
Posts: 2
Joined: Mon Dec 20, 2021 5:00 pm

Re: Recoding alpha series to allow panel unstacking

Postby rjoharanz » Wed Dec 22, 2021 1:17 pm

Good lord, haha thanks Gareth. Yes it seemed from the documentation that it only works on strings.

Merry Christmas!


Return to “Programming”

Who is online

Users browsing this forum: No registered users and 11 guests