## Save scalars in a vector

For questions regarding programming in the EViews programming language.

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

lpando08
Posts: 29
Joined: Tue Apr 03, 2018 1:13 pm

### Save scalars in a vector

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.

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

### Re: Save scalars in a vector

Code: Select all

`vector(10) afor !i=10 to 100 step 10!j = !i/10a(!j)=sum_ssr_hdebt_!i+sum_ssr_ldebt_!inext`

lpando08
Posts: 29
Joined: Tue Apr 03, 2018 1:13 pm

### Re: Save scalars in a vector

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?

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

### Re: Save scalars in a vector

lpando08
Posts: 29
Joined: Tue Apr 03, 2018 1:13 pm

### Re: Save scalars in a vector

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.