Page 1 of 1

model equation defining sum of large number of variables

Posted: Wed Oct 23, 2013 3:06 am
by bernardg
Hello,

I am using Eviews 7.2, updated and am presently trying to write a program that generates a model object. I have a simple problem/question that I have yet to find a good solution to (probably just ignorance on my part):

Let us say for example that I have N equations describing consumption by product CONSi where the number N of products is large (say 100 products). How can I program easily a total consumption equation as the sum of all of these?- ie is there some function that I can use in a model equation to write something like :

mymodel.append CONS=sum(CONSi)

and if N is large, is there a risk that the resulting equation might be "truncated" in the model code? I have seen the @rsum discussion and am not sure whether it applies to my problem (ie what happens at model solve?).

Thanks in advance for any help.
Bernardg

Re: model equation defining sum of large number of variables

Posted: Wed Oct 23, 2013 9:19 am
by EViews Gareth
Normally RSUM would work, but in a model it will not - the model will not be able to parse and expand the group to get the dynamics/interactions of the series inside it.

Your only choice is to write out the sum long form. In a program it isn't too bad. Something like (assuming you have the 100 series in a group called CONSi):

Code: Select all

%expr = consi.@seriesname(1) for !i=2 to consi.@count %expr = %expr + "+" + consi.@seriesname(!i) next mymodell.append CONS={%expr}

Re: model equation defining sum of large number of variables

Posted: Wed Oct 23, 2013 9:24 am
by bernardg
Thanks so much for this, Gareth. I will try and use this.