Using @recode within a FOR loop

For questions regarding programming in the EViews programming language.

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

Dave_the_Forecaster
Posts: 16
Joined: Fri Aug 16, 2013 1:52 am

Using @recode within a FOR loop

Postby Dave_the_Forecaster » Mon Sep 30, 2013 2:29 am

Hi,

I've written a program (the entirety of which I can't share, unfortunately) which has an irritating quirk. All works as intended the first time it is run on a workfile, but if it is run again I get an issue where it seems like the @recode command isn't doing what I want.

Can anyone see an issue with the syntax of these recode commands? %0 is being entered as 2013Q1, 2013Q2 etc.

Code: Select all

for %scenario "All Flat" "with All" %scenario_str = @replace(%scenario, " ", "") m_{%scenario_str} = @recode(@date<=@dateval(%0),na,m_{%scenario_str}) m_{%scenario_str} = @recode(@date=@dateval(%0),m_all,m_{%scenario_str}) next
Apologies for being so vague.

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

Re: Using @recode within a FOR loop

Postby EViews Gareth » Mon Sep 30, 2013 7:42 am

Looks fine. Probably somewhere else in the program that is not working correctly.

Dave_the_Forecaster
Posts: 16
Joined: Fri Aug 16, 2013 1:52 am

Re: Using @recode within a FOR loop

Postby Dave_the_Forecaster » Wed Oct 02, 2013 8:37 am

Thanks. Turns out it was a simple mis-specified sample earlier in the program.

I was under the impression that the @recode command ignored the current workfile sample and relied solely on the 'if' condition entered as an argument.

I was wrong.


Return to “Programming”

Who is online

Users browsing this forum: No registered users and 2 guests