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.
@rows of a series without NA ou zero
Moderators: EViews Gareth, EViews Jason, EViews Moderator, EViews Matt
Re: @rows of a series without NA ou zero
otherwise is it possible to count the number of a certain value in a series?
-
- Fe ddaethom, fe welon, fe amcangyfrifon
- Posts: 13318
- 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
Follow us on Twitter @IHSEViews
Re: @rows of a series without NA ou zero
Greatly appreciated, thanks.
Who is online
Users browsing this forum: No registered users and 67 guests