@rows of a series without NA ou zero

For questions regarding programming in the EViews programming language.

Moderators: EViews Gareth, EViews Jason, EViews Moderator

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

@rows of a series without NA ou zero

Postby sudesh » Thu Nov 30, 2017 1:48 pm

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

Postby sudesh » Thu Nov 30, 2017 1:52 pm

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

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

Re: @rows of a series without NA ou zero

Postby EViews Gareth » Thu Nov 30, 2017 1:55 pm

Code: Select all

smpl if signal<>0 and signal<>NA
scalar count_nonzero = signal.@obs
smpl @all
Follow us on Twitter @IHSEViews

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

Re: @rows of a series without NA ou zero

Postby sudesh » Thu Nov 30, 2017 2:49 pm

Greatly appreciated, thanks.


Return to “Programming”

Who is online

Users browsing this forum: Baidu [Spider] and 11 guests