Replacing for loops

For questions regarding programming in the EViews programming language.

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

weu39843
Posts: 10
Joined: Fri Oct 21, 2016 1:05 am

Replacing for loops

Postby weu39843 » Mon Oct 31, 2016 8:40 am

Hey guys,

I have monthly data from January 1981 till December 2016 (the format is "yyyy[M]MM"). Im running the following two for loops in order to analyze each point in time:

for !year = 1981 to 2016
for !month = 1 to 12
smpl !yearM!month !yearM!month if...(several conditions regarding the variables)
next
next

Is there a possibility to replace the two loops with one? For example, something like this:

for !date = 1981M1 to 2016M12 step 1
smpl !date !date if....
next

Thank you in advance!

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

Re: Replacing for loops

Postby EViews Gareth » Mon Oct 31, 2016 9:20 am

You're better off using the @otod and @dtoo functions to convert into observation space rather than dealing with dates.


Return to “Programming”

Who is online

Users browsing this forum: No registered users and 1 guest