Counting positive series values in a Loop

For questions regarding programming in the EViews programming language.

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

brandon.ellse
Posts: 3
Joined: Thu Dec 10, 2015 6:50 am

Counting positive series values in a Loop

Postby brandon.ellse » 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

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

Re: Counting positive series values in a Loop

Postby EViews Gareth » Fri Nov 18, 2016 6:48 am

Code: Select all

smpl if error2>0 !overestimate = @obssmpl smpl if error2<0 !overestimate = @obssmpl


Return to “Programming”

Who is online

Users browsing this forum: No registered users and 2 guests