@replace question

For questions regarding programming in the EViews programming language.

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

BT454
Posts: 11
Joined: Wed Aug 02, 2017 6:07 am

@replace question

Postby BT454 » Thu Oct 18, 2018 7:31 am

Hi all,
I have a long list of series in a work file. The series names are set up as a merger of concept and geography i.e. priceus, pricecan.
I'd like to create a string of all the series, and remove the common concept characters from each name in the string. I'm attempting to use the @replace command, but I'm not having any luck. In this instance the code I'm using is:

group g_all cat* '(all series that start with "cat")
%vars = g_all.@members 'create string of all series starting with cat
%vars = @replace(%vars,"cat","") 'replace characters "cat" with nothing
show %vars 'display contents of string to check that characters have been removed

However, the code is not working, and cat is not removed from any of the series when the string is displayed.
Any insight or help is appreciated.
Thanks!
Bob

EViews Matt
EViews Developer
Posts: 302
Joined: Thu Apr 25, 2013 7:48 pm

Re: @replace question

Postby EViews Matt » Thu Oct 18, 2018 9:25 am

Hello,

The series names are being returned to you in uppercase, and @replace is case sensitive. Simply change your search string from "cat" to "CAT".

BT454
Posts: 11
Joined: Wed Aug 02, 2017 6:07 am

Re: @replace question

Postby BT454 » Thu Oct 18, 2018 10:54 am

That worked. Thanks!


Return to “Programming”

Who is online

Users browsing this forum: No registered users and 14 guests