Program lagged variables from a table

For questions regarding programming in the EViews programming language.

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

jthorpe
Posts: 1
Joined: Sat Nov 14, 2020 10:35 am

Program lagged variables from a table

Postby jthorpe » Sat Nov 14, 2020 10:42 am

Hi there,

I have a table of lags for variables, and I wish to be able to incorporate into my program a way to pull the value of the lag from the table, and into my program that will result in regressions. If you were using excel it would be some form of Index Match formula, but I don't know how to do this in EViews programming

This is the start of my program:

for %j dm
next
for %y 5y5y_be
next
for %p pmi
next
for %x liq
next
for %l1 -1
next

equation {%j}_{%y}_{%x}1.ls {%j}_{%y} c {%p} {%x}1({%l0})

table tab_{%j}_{%y}
tab_{%j}_{%y}(1,1) = "PMI co-eff"
tab_{%j}_{%y}(2,1) = {%j}_{%x}_{%y}1.@coef(2)

I have a table called tab_lags, which I would like the program to be able to go into, find the value of {%j}_{%y}_{%x}1, and then return the associated the lag value where I currently have %l1 -1.

Hopefully this makes sense, any comments/guidance most welcome.

Thanks!
Joe

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

Re: Program lagged variables from a table

Postby EViews Matt » Mon Nov 16, 2020 11:37 am

Hello,

You'll need to explicitly search through the table to find the row that matches your name of interest, e.g.,

Code: Select all

for !i = 1 to tab_lags.@rows if tab_lags(!i, 1) = %j + "_" + %y + "_" + %x + "1" then exitloop endif next %l1 = tab_lags(!i, 2)
And FYI, your for loops will need some reorganization once you're actually looping through multiple value combinations.


Return to “Programming”

Who is online

Users browsing this forum: No registered users and 2 guests