replace specific character in the name of a series

For questions regarding programming in the EViews programming language.

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

Megalodn
Posts: 5
Joined: Fri Nov 18, 2016 2:38 am

replace specific character in the name of a series

Postby Megalodn » Fri Nov 18, 2016 2:44 am

Hi all,

I am completely new to eviews and figuring out how stuff works here. I have about 50 series named y_b_ar12, y_b_ar13, y_z_ar12....

I want eviews to loop through these series and change the b in the series name to z. Through google and trying I got the following code so far:

Code: Select all

group g y* for !i=1 to g.@count %oldname = g.@seriesname(!i) %newname=@replace(%oldname,"*b*","*z*") rename {%oldname} {%newname} next
The problem is the @replace function, which returns no error but does not replace the b with the z, either.
It is probably a simple solution I am missing here, but I just cannot find it.
Any help is greatly appreciated.

Best,

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

Re: replace specific character in the name of a series

Postby EViews Gareth » Fri Nov 18, 2016 2:51 am

Remove the asterisks in the replace function.

Megalodn
Posts: 5
Joined: Fri Nov 18, 2016 2:38 am

Re: replace specific character in the name of a series

Postby Megalodn » Fri Nov 18, 2016 2:57 am

Hey, thank you for the reply.

I did replace it like this:

Code: Select all

%newname=@replace(%oldname,"b","z")
However, that did not work, unfortunately.

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

Re: replace specific character in the name of a series

Postby EViews Gareth » Fri Nov 18, 2016 3:32 am

Code: Select all

%newname=@replace(%oldname,"B","Z")
Series names are uppercase.

Megalodn
Posts: 5
Joined: Fri Nov 18, 2016 2:38 am

Re: replace specific character in the name of a series

Postby Megalodn » Fri Nov 18, 2016 3:39 am

Bang - that it is.
Thank you so much.


Return to “Programming”

Who is online

Users browsing this forum: No registered users and 2 guests