using dates in a FOR loop with unkown freq and smpl range

For questions regarding programming in the EViews programming language.

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

BBuser1
Posts: 19
Joined: Wed May 11, 2011 12:58 pm

using dates in a FOR loop with unkown freq and smpl range

Postby BBuser1 » Tue May 31, 2011 9:12 am

Eviews 7
What's the most efficient way to step through each data point within an unknown smpl of unknown frequency? For example: a loop that runs for each day of a D5 freq file over a 3 month smpl, or a loop that steps through each month of a monthly freq file over a two year smpl. The freq and smpl will be changing. Will a FOR loop recognize dates? I've tried several variations but can't get it to work. ! loops are integer-only and % loops work off lists?

Thanks.

tchaithonov
Posts: 168
Joined: Mon Apr 13, 2009 7:39 am
Location: New York City

Re: using dates in a FOR loop with unkown freq and smpl rang

Postby tchaithonov » Tue May 31, 2011 12:08 pm

The frequency part depends on the workpage, so in terms of the for loop, it's just add 1 (or if you use @dateadd, that would require a bit of work on the @pagefreq front). As to the duration of the smpl (3 months vs 2 years), could you find out from either the @pagesmpl or @smpl function in equation (if you are running one)?

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

Re: using dates in a FOR loop with unkown freq and smpl rang

Postby EViews Gareth » Wed Jun 01, 2011 9:10 am

Further to what has already been said, remember that you can use offsets in smpl commands too, so that you can do:

Code: Select all

smpl @first+10 @first+15
which will be the 11th through 16th observations, no matter what the frequency of the page is.

Also, you can use the @otod function to convert from observation number to dates.


Return to “Programming”

Who is online

Users browsing this forum: No registered users and 2 guests