%if statements in dofor loops?
Posted: Fri Oct 02, 2015 11:45 pm
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)
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)