Rename series loop

For questions regarding programming in the EViews programming language.

Moderators: EViews Gareth, EViews Moderator, EViews Jason, EViews Matt

bpuffer
Posts: 15
Joined: Fri Jun 20, 2014 7:15 am

Rename series loop

Postby bpuffer » Tue Nov 11, 2014 5:28 pm

Hello,

I am attempting to rename a group of series by replacing part of the series name with an equivalent but different name. See below for an example:

pop_35614 rename as pop_newy
pop_31084 rename as pop_losa

Basically, I have two lists: one with the numbers (35614, 31084, etc.) and a matching one with the replacements (newy, losa, etc.). Since there are 71 different series, how can I rename these without having to rename them one by one?

Thanks!

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

Re: Rename series loop

Postby EViews Gareth » Tue Nov 11, 2014 8:22 pm

Where are the lists stored?

bpuffer
Posts: 15
Joined: Fri Jun 20, 2014 7:15 am

Re: Rename series loop

Postby bpuffer » Wed Nov 12, 2014 7:21 am

Currently they are in a temp variable

%MET = "35614 31084 etc"
%METR = "newy losa etc"

BUT, I can organize it whatever way is the best way to go about replacing one with the other.

Thanks!

Brendon

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

Re: Rename series loop

Postby EViews Gareth » Wed Nov 12, 2014 8:56 am

Code: Select all

for !i=1 to @wcount(%met) %src = @word(%met,!i) %dest = @word(%metr, !i) rename pop_{%src} pop_{%dest} next

bpuffer
Posts: 15
Joined: Fri Jun 20, 2014 7:15 am

Re: Rename series loop

Postby bpuffer » Wed Nov 12, 2014 12:08 pm

Thank you very much! This is great!


Return to “Programming”

Who is online

Users browsing this forum: No registered users and 2 guests