Page 1 of 1

Rename series loop

Posted: Tue Nov 11, 2014 5:28 pm
by bpuffer
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!

Re: Rename series loop

Posted: Tue Nov 11, 2014 8:22 pm
by EViews Gareth
Where are the lists stored?

Re: Rename series loop

Posted: Wed Nov 12, 2014 7:21 am
by bpuffer
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

Re: Rename series loop

Posted: Wed Nov 12, 2014 8:56 am
by EViews Gareth

Code: Select all

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

Re: Rename series loop

Posted: Wed Nov 12, 2014 12:08 pm
by bpuffer
Thank you very much! This is great!