Loop for samples

For questions regarding programming in the EViews programming language.

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

banhbengconuong
Posts: 15
Joined: Mon Apr 25, 2011 8:31 pm

Loop for samples

Postby banhbengconuong » Wed Mar 19, 2014 9:59 pm

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.

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

Re: Loop for samples

Postby EViews Gareth » Wed Mar 19, 2014 10:16 pm

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

banhbengconuong
Posts: 15
Joined: Mon Apr 25, 2011 8:31 pm

Re: Loop for samples

Postby banhbengconuong » Wed Mar 19, 2014 10:26 pm

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

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

Re: Loop for samples

Postby EViews Gareth » Thu Mar 20, 2014 8:08 am

ah, of course.


Return to “Programming”

Who is online

Users browsing this forum: No registered users and 2 guests