Page 1 of 1

@rows of a series without NA ou zero

Posted: Thu Nov 30, 2017 1:48 pm
by sudesh
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.

Re: @rows of a series without NA ou zero

Posted: Thu Nov 30, 2017 1:52 pm
by sudesh
otherwise is it possible to count the number of a certain value in a series?

Re: @rows of a series without NA ou zero

Posted: Thu Nov 30, 2017 1:55 pm
by EViews Gareth

Code: Select all

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

Re: @rows of a series without NA ou zero

Posted: Thu Nov 30, 2017 2:49 pm
by sudesh
Greatly appreciated, thanks.