## @rows of a series without NA ou zero

For questions regarding programming in the EViews programming language.

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

sudesh
Posts: 51
Joined: Fri Nov 03, 2017 7:30 pm

### @rows of a series without NA ou zero

Hi, I would like to count the number of non zero rows in a series.

I have first initiate zero value of the series,

smpl 1970w1 @now

series signal = 0

and then based upon certain rule, I have assigned value of -1, -05, 0, 0.5 and I to the series.

I was able to calculate the size of my sample by @rows( signal) which is 2500.

Now I would like to count the number of 0 in the series

I tired this method but in vain.

if signal <> 0 then
scalar count_nonzero = @rows( signal)
end if

Thanks for the help.

sudesh
Posts: 51
Joined: Fri Nov 03, 2017 7:30 pm

### Re: @rows of a series without NA ou zero

otherwise is it possible to count the number of a certain value in a series?

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

### Re: @rows of a series without NA ou zero

Code: Select all

smpl if signal<>0 and signal<>NA
scalar count_nonzero = signal.@obs
smpl @all

sudesh
Posts: 51
Joined: Fri Nov 03, 2017 7:30 pm

### Re: @rows of a series without NA ou zero

Greatly appreciated, thanks.