removing the end of object names in workfile

For questions regarding the import, export and manipulation of data in EViews, including graphing and basic statistics.

Moderators: EViews Gareth, EViews Jason, EViews Steve, EViews Moderator

remuct
Posts: 27
Joined: Fri May 12, 2017 6:47 am

removing the end of object names in workfile

Postby remuct » Mon May 03, 2021 9:35 am

Hello,
I am trying to simplify a big number of imported series in a Eviews workfile. To this end, I need to remove all the characters after some core name that I want to keep. For example, if I have a series named like:

investment_dy_inv_dy

is there a way of using the wildcard characters to keep "investment_dy" end remove "_inv_dy" (the last part of the name)?

Thanks

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

Re: removing the end of object names in workfile

Postby EViews Gareth » Mon May 03, 2021 9:36 am

Code: Select all

rename *_inv_dy *
Follow us on Twitter @IHSEViews

remuct
Posts: 27
Joined: Fri May 12, 2017 6:47 am

Re: removing the end of object names in workfile

Postby remuct » Mon May 03, 2021 10:37 am

Thank you so much, another such problem is illustrated in the following example. My series names are:
axy_1
bxy23
cxy__gdp
and many other names including xy which, in turn, are followed by different characters.

I want to remove all the characters after xy, but without specifying them one by one because there are a lot of them, and keep only:

axy
bxy
cxy

Is there a way of saying Eviews to remove all the characters after a (some) specified one(s)?
Thank you

remuct
Posts: 27
Joined: Fri May 12, 2017 6:47 am

Re: removing the end of object names in workfile

Postby remuct » Tue May 04, 2021 2:09 am

Hello, please forgive me for coming back to the issue of my last post, I would like to know if there is a way of solving this problem using wildcards or another tool:

My series names are, say:
axy_1, bxyusa, cxy__gdp, ... and many other names including xy which are followed by different characters.

I want to remove all the characters after xy, but without specifying them one by one because I have a large number of such series names and the parts to remove are all different, and keep only:

axy, bxy, cxy, ...

Is there a way of asking Eviews to remove all after xy ?
Thanks

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

Re: removing the end of object names in workfile

Postby EViews Gareth » Tue May 04, 2021 9:09 am

Not with a wildcard. You'd have to write a for loop that loops through them all doing the rename one at a time.

Code: Select all

%list = @wlookup("*xy*", "series")
for %j {%list}
!posxy = @instr(%j, "XY")
%newname = @left(%j, !posxy+1)
rename {%j} {%newname}
next
Follow us on Twitter @IHSEViews

remuct
Posts: 27
Joined: Fri May 12, 2017 6:47 am

Re: removing the end of object names in workfile

Postby remuct » Wed May 05, 2021 9:36 am

That works! Thanks so much Gareth, this is a great help...


Return to “Data Manipulation”

Who is online

Users browsing this forum: No registered users and 20 guests