I want to know how many positive numbers are in a series. in Excel its a simple countif > o type formula. What would be the eviews equivalent?
Thanks!
What's the eviews equivalent of Excel's countif?
Moderators: EViews Gareth, EViews Jason, EViews Moderator, EViews Matt
-
- Posts: 199
- Joined: Sun Mar 01, 2015 5:01 pm
-
- Posts: 199
- Joined: Sun Mar 01, 2015 5:01 pm
Re: What's the eviews equivalent of Excel's countif?
Thanks but I'm not getting that to work.
I get this message:
NA found in matrix in "SCALAR TEST= @SUM(x>0)".
The sereies has some Nas, but even when I fill them in I get this error message:
Scalar sent to function which operates on a matrix in "SCALAR TEST=@SUM(x>0)".
Any ideas?
Thanks
I get this message:
NA found in matrix in "SCALAR TEST= @SUM(x>0)".
The sereies has some Nas, but even when I fill them in I get this error message:
Scalar sent to function which operates on a matrix in "SCALAR TEST=@SUM(x>0)".
Any ideas?
Thanks
-
- Non-normality and collinearity are NOT problems!
- Posts: 3775
- Joined: Wed Sep 17, 2008 2:25 pm
Re: What's the eviews equivalent of Excel's countif?
Not sure, but are you sure that X is a series as opposed to a vector or matrix?
-
- Fe ddaethom, fe welon, fe amcangyfrifon
- Posts: 13307
- Joined: Tue Sep 16, 2008 5:38 pm
Re: What's the eviews equivalent of Excel's countif?
You have to, unfortunately, do it in two steps.
Code: Select all
smpl if x1>0
scalar test = @obssmpl
Follow us on Twitter @IHSEViews
-
- Posts: 199
- Joined: Sun Mar 01, 2015 5:01 pm
Re: What's the eviews equivalent of Excel's countif?
Thanks Gareth!
-
- Posts: 199
- Joined: Sun Mar 01, 2015 5:01 pm
Re: What's the eviews equivalent of Excel's countif?
Can I use this sample sample trick to replace outliers in a series with NAs? Say I want to remove the highest and lowest 5% of observations in a series can i put somehting in this blank space that would do that?
Code: Select all
smpl if x1>_____
-
- Non-normality and collinearity are NOT problems!
- Posts: 3775
- Joined: Wed Sep 17, 2008 2:25 pm
Re: What's the eviews equivalent of Excel's countif?
You certainly can, but look at the @replace function which might be easier.
-
- Posts: 199
- Joined: Sun Mar 01, 2015 5:01 pm
Re: What's the eviews equivalent of Excel's countif?
Im not familiar with the replace function but I found the following code which worked well. Thanks
Code: Select all
series y = @recode(@abs(x) < @quantile(@abs(x), .9), x, na)
-
- Non-normality and collinearity are NOT problems!
- Posts: 3775
- Joined: Wed Sep 17, 2008 2:25 pm
Re: What's the eviews equivalent of Excel's countif?
I meant @recode. So you're ahead of me.
-
- Posts: 199
- Joined: Sun Mar 01, 2015 5:01 pm
Re: What's the eviews equivalent of Excel's countif?
ah, ok. Thanks.
Who is online
Users browsing this forum: No registered users and 32 guests