@rsum

For questions regarding programming in the EViews programming language.

Moderators: EViews Gareth, EViews Moderator, EViews Jason, EViews Matt

javiersan
Posts: 184
Joined: Mon Jan 19, 2009 8:18 am

@rsum

Postby javiersan » Thu Dec 15, 2011 7:02 am

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

startz
Non-normality and collinearity are NOT problems!
Posts: 3798
Joined: Wed Sep 17, 2008 2:25 pm

Re: @rsum

Postby startz » Thu Dec 15, 2011 7:24 am

Use @nan.

Code: Select all

group g @nan(x,0) @nan(y,0) @rsum(g)

javiersan
Posts: 184
Joined: Mon Jan 19, 2009 8:18 am

Re: @rsum

Postby javiersan » Thu Dec 15, 2011 8:45 am

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

EViews Glenn
EViews Developer
Posts: 2682
Joined: Wed Oct 15, 2008 9:17 am

Re: @rsum

Postby EViews Glenn » Thu Dec 15, 2011 10:39 am

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)

startz
Non-normality and collinearity are NOT problems!
Posts: 3798
Joined: Wed Sep 17, 2008 2:25 pm

Re: @rsum

Postby startz » Thu Dec 15, 2011 12:32 pm

The confusion is entire Glenn's fault. He keeps thinking I'll read the documentation... :oops:

EViews Glenn
EViews Developer
Posts: 2682
Joined: Wed Oct 15, 2008 9:17 am

Re: @rsum

Postby EViews Glenn » Thu Dec 15, 2011 12:39 pm

I should point out that your suggestion does work...

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

Re: @rsum

Postby EViews Gareth » Thu Dec 15, 2011 12:50 pm

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.


Return to “Programming”

Who is online

Users browsing this forum: No registered users and 2 guests