Page 1 of 1
@rsum
Posted: Thu Dec 15, 2011 7:02 am
by javiersan
Is there a way of summing the row elements of a group of series carrying the NAs as zeros? i.e. not having a NA result in the @rsum when one or more of the series has a NA value.
Thanks
Javier
Re: @rsum
Posted: Thu Dec 15, 2011 7:24 am
by startz
Use @nan.
Code: Select all
group g @nan(x,0) @nan(y,0)
@rsum(g)
Re: @rsum
Posted: Thu Dec 15, 2011 8:45 am
by javiersan
Thanks, clever solution. I have series names in a string and wrapping each of them in @nan(,0) becomes complicated (with @wcross), an off-the-shelf solution could be great. Gareth, could you please add a variation of @rsum that carries NAs as zeros?
Javier
Re: @rsum
Posted: Thu Dec 15, 2011 10:39 am
by EViews Glenn
I'm confused. @rsum should not propagate NAs unless all elements are NAs.
If the latter point is the issue, you could always recode the end result.
series y = @rsum(group01)
y = @nan(y, 0)
Re: @rsum
Posted: Thu Dec 15, 2011 12:32 pm
by startz
The confusion is entire Glenn's fault. He keeps thinking I'll read the documentation...

Re: @rsum
Posted: Thu Dec 15, 2011 12:39 pm
by EViews Glenn
I should point out that your suggestion does work...
Re: @rsum
Posted: Thu Dec 15, 2011 12:50 pm
by EViews Gareth
Can't we just pretend that this morning @RSUM propagated NAs, so didn't do what Javiersan wanted, but then he asked me to make a variation that didn't propagate NAs (unless all are NA), which I then did and magically updated all copies of EViews 7? I think that way everyone comes out a winner.