Page 1 of 1

Save scalars in a vector

Posted: Wed Apr 18, 2018 7:22 am
by lpando08
Hello,

I have this loop:

for !i=10 to 100 step 10
scalar ssrt_!i=sum_ssr_hdebt_!i+sum_ssr_ldebt_!i
next

I would like to know how to save the scalars that it generate, I mean ssrt_10, ssrt_11,etc in a vector and then find the minimun of that vector.

Thank you for your help.

Re: Save scalars in a vector

Posted: Wed Apr 18, 2018 7:24 am
by EViews Gareth

Code: Select all

vector(10) a for !i=10 to 100 step 10 !j = !i/10 a(!j)=sum_ssr_hdebt_!i+sum_ssr_ldebt_!i next

Re: Save scalars in a vector

Posted: Wed Apr 18, 2018 7:36 am
by lpando08
And is there a way to indentify which is the minimun value of that vector, I mean to identify which scalar ssrt_!i is the minimun value of that vector?

Re: Save scalars in a vector

Posted: Wed Apr 18, 2018 8:10 am
by EViews Gareth

Re: Save scalars in a vector

Posted: Wed Apr 18, 2018 9:22 am
by lpando08
And if I want to run the loop from 1 to 100 without the step and save the 91 values in a vector? How I could conduct that?

vector(91) a
for !i=10 to 100
for !j=1 to 91
a(!j)=ssrt_!i
next
next

I have run something like this but it gives me the same value (the last ssrt_!i of the loop) in all the rows of the vector.