Page 1 of 1

Loop for samples

Posted: Wed Mar 19, 2014 9:59 pm
by banhbengconuong
Hello everyone,

I am trying to make a loop for different samples using the code I wrote below:

for %samle = s1 s2 s3 s4 all
smpl %sample
freeze(tab1_{%sample}) gr_d1_core.stats
tab1_{%sample}(4,1) = "Statistics/Variable"
next

However, Eviews told me that there were an error. Does anyone know how to fix this? Thank you very much.

Re: Loop for samples

Posted: Wed Mar 19, 2014 10:16 pm
by EViews Gareth

Code: Select all

for %samle s1 s2 s3 s4 @all smpl {%sample} freeze(tab1_{%sample}) gr_d1_core.stats tab1_{%sample}(4,1) = "Statistics/Variable" next

Re: Loop for samples

Posted: Wed Mar 19, 2014 10:26 pm
by banhbengconuong
Many thanks, I have done it, but because eviews doesn't allow to put @ in the name of object, so I defined the sample all before doing the loop.

Code: Select all

for %samle s1 s2 s3 s4 @all smpl {%sample} freeze(tab1_{%sample}) gr_d1_core.stats tab1_{%sample}(4,1) = "Statistics/Variable" next

Re: Loop for samples

Posted: Thu Mar 20, 2014 8:08 am
by EViews Gareth
ah, of course.