loop and rename

For questions regarding programming in the EViews programming language.

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

arpaial
Posts: 7
Joined: Wed Sep 23, 2009 2:49 pm

loop and rename

Postby arpaial » Thu May 23, 2013 8:26 am

I have estimated the Impulse response functions for 27 countries with a loop on a VAR and saved them in matrix var_irf{!i} for !i= 1 to 27

Now I want to transform the matrix in a group of series and rename each series so that the first index in IRF_1_1 stands for country 1 and the second for the response of the first variable to the first shock; the second index goes from 1 to pxp where p is the number of variables in the VAR. I have 4 variables so and the second index goers from 1 to 16

I have attached below the program

pagecreate(page=IRF) u 1 10

for !i =1 to 27

copy crossection_EU\var_irf{!i} IRF\var_irf{!i}
mtos(var_irf{!i}, group{!i})
next

for !i =1 to 9
rename ser0{!i} ser{!i}
next

for !i =1 to 27
for !j =1 to @columns(group{!i})
rename ser{!j} IRF_{!i}_{!j}
next
next

The problem is that it renames the series only for country 1 ; for country 2 I got the following error message: SER1 is not defined in "RENAME SER 1IRF_2_1"

I understand that the problem is that the first series in group 2 does not start with SER1 but with SER17 but I m' not able to change this in the programme

I would appreciate any help for this

Regards
Alfonso

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

Re: loop and rename

Postby EViews Gareth » Thu May 23, 2013 8:34 am

I can't see what is causing that, so can't offer any advice.


Return to “Programming”

Who is online

Users browsing this forum: No registered users and 2 guests