Counting positive series values in a Loop
Posted: Fri Nov 18, 2016 6:35 am
Hi,
I know that this is incredibly basic, but I'm obviously making some silly syntax error with this and I've already wasted several hours trying to figure it out.
All I want to do is count the number of positive values and negative in the series and show each number -- after removing the NAs. The 'error2' variable has been created by subtracting one series from another prior to this. When I show the !overestimate and !underestimate, they're just giving me a zero.
for !i=0 to @obsrange-1
smpl @first+!i @first+!i
if error2>0 then
!overestimate = !overestimate+1
if error2<0 then
!underestimate = !underestimate+1
endif
endif
next
show !underestimate !overestimate
I know that this is incredibly basic, but I'm obviously making some silly syntax error with this and I've already wasted several hours trying to figure it out.
All I want to do is count the number of positive values and negative in the series and show each number -- after removing the NAs. The 'error2' variable has been created by subtracting one series from another prior to this. When I show the !overestimate and !underestimate, they're just giving me a zero.
for !i=0 to @obsrange-1
smpl @first+!i @first+!i
if error2>0 then
!overestimate = !overestimate+1
if error2<0 then
!underestimate = !underestimate+1
endif
endif
next
show !underestimate !overestimate