Adding date to loop

For questions regarding programming in the EViews programming language.

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

Alfa318
Posts: 4
Joined: Sat Jul 25, 2020 6:54 pm

Adding date to loop

Postby Alfa318 » Wed Jun 08, 2022 6:19 am

I'm using EViews 11 to run the following simple code for a sample of 173 firms:

Code: Select all

vector(173) myvec for !i=1 to 173 smpl if c_id=!i myvec(!i) = @cor(ret,ret(-1)) next
I have a daily data file, how can I run the above loop for every month separately? I don't know how to introduce date restrictions in the loop. Many thanks.

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

Re: Adding date to loop

Postby EViews Gareth » Wed Jun 08, 2022 7:32 am

Code: Select all

for !i=1 to 12 smpl if @month=!i next
Follow us on Twitter @IHSEViews

Alfa318
Posts: 4
Joined: Sat Jul 25, 2020 6:54 pm

Re: Adding date to loop

Postby Alfa318 » Sat Jun 11, 2022 3:10 am

Thanks a lot! :mrgreen:


Return to “Programming”

Who is online

Users browsing this forum: No registered users and 2 guests