Page 1 of 1

Generate a sum vector

Posted: Wed Apr 11, 2018 2:12 pm
by lpando08
Hello, I have run this:

for %c {%grp}
for !j = 1 to var_{%c}.@neqn
vector(!j) ssr_{%c}(!j) = var_{%c}.@ssr(!j)
vector sum_ssr_{%c}(1)=@sum(ssr_{%c})

where %grp = h dev fixed flex open closed hdebt ldebt

Is there a way to generate a vector like this: ssrt_debt(1)= sum_ssr_ldebt+sum_ssr_hdebt, to sum only the sum_ssr vector for hdebt and for ldebt? I have run this but it doesn't work.

Thank you!

Re: Generate a sum vector

Posted: Wed Apr 11, 2018 3:07 pm
by EViews Matt

Code: Select all

vector ssrt_debt = sum_ssr_ldebt + sum_ssr_hdebt

That said, if your sum_ssr_{%c} vectors are only ever going to hold one element, use scalars instead of vectors. And there's no point to calculating sum_ssr_{%c} until after you've finished calculating ssr_{%c}, i.e., move that statement after the inner for loop. Finally, you don't need the "(1)" that's currently in your program.