renaming series ... adding an increasing suffix

For requesting general information about EViews, sharing your own tips and tricks, and information on EViews training or guides.

Moderators: EViews Gareth, EViews Moderator

dsdsdsdsd
Posts: 21
Joined: Sun Sep 06, 2020 7:33 pm

renaming series ... adding an increasing suffix

Postby dsdsdsdsd » Sat Nov 07, 2020 6:54 am

hello ...

I have series: yr05 , yr06 , ...

I want: yr1980 , yr1981 , ...

I have tried variations of:

Code: Select all

rename yr* @left( "yr" + @str( @val(*) + 1975)  ,  999 )


I am using @left simply because it returns ...

thanks

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

Re: renaming series ... adding an increasing suffix

Postby EViews Matt » Mon Nov 09, 2020 11:00 am

Hello,

Unfortunately, the rename command does not accept functional transforms, only patterns. However, you can easily achieve your goals with a loop.

Code: Select all

%series = @wlookup("yr*", "series")
for %s {%series}
   %new_name = "yr" + @str(@val(@mid(%s, 3)) + 1975)
   rename {%s} {%new_name}
next


Return to “General Information and Tips and Tricks”

Who is online

Users browsing this forum: No registered users and 13 guests