Page 1 of 1

Using @recode within a FOR loop

Posted: Mon Sep 30, 2013 2:29 am
by Dave_the_Forecaster
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.

Re: Using @recode within a FOR loop

Posted: Mon Sep 30, 2013 7:42 am
by EViews Gareth
Looks fine. Probably somewhere else in the program that is not working correctly.

Re: Using @recode within a FOR loop

Posted: Wed Oct 02, 2013 8:37 am
by Dave_the_Forecaster
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.