Page 1 of 1

Program lagged variables from a table

Posted: Sat Nov 14, 2020 10:42 am
by jthorpe
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

Re: Program lagged variables from a table

Posted: Mon Nov 16, 2020 11:37 am
by EViews Matt
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.