Scalar names in table

For questions regarding programming in the EViews programming language.

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

NoGu
Posts: 2
Joined: Fri Jan 22, 2021 6:03 am

Scalar names in table

Postby NoGu » Fri Jan 22, 2021 6:14 am

I want to create a table with two columns. First column should be the names of the scalars and the second column the value. Part two is solved. Is it possible to create a loop and get the names of the scalars in col1?

EViews Matt
EViews Developer
Posts: 560
Joined: Thu Apr 25, 2013 7:48 pm

Re: Scalar names in table

Postby EViews Matt » Mon Jan 25, 2021 2:27 pm

Hello,

Sure, here's a small example.

Code: Select all

create u 1
table(3,2) t
t(1,1) = "x"
t(2,1) = "y"
t(3,1) = "z"
t(1,2) = 1
t(2,2) = 2
t(3,2) = 3

for !i = 1 to t.@rows
   %name = t(!i,1)
   scalar {%name} = @val(t(!i,2))
next

NoGu
Posts: 2
Joined: Fri Jan 22, 2021 6:03 am

Re: Scalar names in table

Postby NoGu » Mon Feb 01, 2021 7:58 am

Thank you, I will try that!


Return to “Programming”

Who is online

Users browsing this forum: No registered users and 28 guests