Page 1 of 1

Partially renaming series names

Posted: Tue Jul 13, 2021 3:44 pm
by remuct
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

Re: Partially renaming series names

Posted: Tue Jul 13, 2021 4:00 pm
by EViews Gareth

Code: Select all

%serlist = @wlookup("*", "series") for %j {%serlist} !pos_ = @rinstr(%j, "_") %newname = @left(%j, !pos_) + "p" rename {%j} {%newname} next

Re: Partially renaming series names

Posted: Tue Jul 13, 2021 5:00 pm
by remuct
This is amazing Gareth, thanks !