Hello,
I have many series whose names include one or more underscore(s) and I wish to rename all characters following the last underscore by a given letter, say 'p'. For example, the following series
us_gdp_u1
uk_interest_rate_xy3
can_w
must be renamed as:
us_gdp_p
uk_interest_rate_p
can_p
Is there an easy way to do this?
Thank you
Best regards
Partially renaming series names
Moderators: EViews Gareth, EViews Jason, EViews Steve, EViews Moderator
-
- Fe ddaethom, fe welon, fe amcangyfrifon
- Posts: 13315
- Joined: Tue Sep 16, 2008 5:38 pm
Re: Partially renaming series names
Code: Select all
%serlist = @wlookup("*", "series")
for %j {%serlist}
!pos_ = @rinstr(%j, "_")
%newname = @left(%j, !pos_) + "p"
rename {%j} {%newname}
next
Follow us on Twitter @IHSEViews
Re: Partially renaming series names
This is amazing Gareth, thanks !
Who is online
Users browsing this forum: No registered users and 17 guests