Hi. I trying to figure out a bug in my code. I have 100 or so series and I am trying to clean up any missing values.I am trying to use the following code. If I use the dofor loop, I only get a column of 1s. If I use the code outside of the loop, the Na observation is fixed according to the %if statement. Can %if statements not be used inside of a dofor loop? Any help would be greatly appreciated.
dofor i = RPI
set %s(%l(i)) = %if(%valid(i), i, (i{1} + i{-1})/2)
end
set rpi = %if(%valid(rpi), rpi, (rpi{1} + rpi{-1})/2)
%if statements in dofor loops?
Re: %if statements in dofor loops?
You need i{0} to get the current value of the series for the DOFOR index.
Re: %if statements in dofor loops?
Thanks. Works perfectly now. Much appreciated.