loop with string and scalar combined

For questions regarding programming in the EViews programming language.

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

dasilver
Posts: 8
Joined: Wed Aug 04, 2010 11:35 am

loop with string and scalar combined

Postby dasilver » Tue Mar 06, 2012 8:31 am

I am trying to do a loop that combines numeric scalars and strings - basically I want to associate month numbers with month names (ie 1 = jan, 2 = feb, etc.). I tried using the following two methods (one with one loop, one with two separate loops), but these crash Eviews. Is there a way to do this successfully?

Thank you in advance.

METHOD 1
for !mtnum %mtnam 1 jan 2 feb 3 mar
smpl if mt = {!mtnum} AND (yr = 2008 OR yr = 2009)
ism_nsa_adj = {%mtnam}
next

METHOD 2
for !mtnum 1 2 3
for %mtnam jan feb mar
smpl if mt = {!mtnum} AND (yr = 2008 OR yr = 2009)
ism_nsa_adj = {%mtnam}
next
next

startz
Non-normality and collinearity are NOT problems!
Posts: 3796
Joined: Wed Sep 17, 2008 2:25 pm

Re: loop with string and scalar combined

Postby startz » Tue Mar 06, 2012 8:49 am

If they really crash EViews, you should probably update your copy. That may not fix the problem, but EViews shouldn't be crashing.


Return to “Programming”

Who is online

Users browsing this forum: No registered users and 2 guests