Page 1 of 1
removing the end of object names in workfile
Posted: Mon May 03, 2021 9:35 am
by remuct
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
Re: removing the end of object names in workfile
Posted: Mon May 03, 2021 9:36 am
by EViews Gareth
Re: removing the end of object names in workfile
Posted: Mon May 03, 2021 10:37 am
by remuct
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
Re: removing the end of object names in workfile
Posted: Tue May 04, 2021 2:09 am
by remuct
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
Re: removing the end of object names in workfile
Posted: Tue May 04, 2021 9:09 am
by EViews Gareth
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
Re: removing the end of object names in workfile
Posted: Wed May 05, 2021 9:36 am
by remuct
That works! Thanks so much Gareth, this is a great help...