Re: List from string in a function
I now see the problem I ran into is intrinsic to how Gretl functions
work. The string substitution in the function below fails because
the scope of the function does not let it see the series in the open
workfile
function matrix olslist1(string xstring)
list xlist= @xstring #fails
ols dy const xlist
#ols dy const @xstring #also fails
return $coeff
end function
I.e even explicit list definition in a function fails
list xlist= dy
Is there a work around that gives a function global type access to all
series in an open workfile?
I can see the potential danger here, but if possible in a future GRETL
release, it would be nice to be able to read from inside a function
any existing series (maybe with some type of write protection) without
needing to pre-specify a list with all of the series the function
'might' use. In my 'use case' I am dynamically creating a set of
lagged explanatory variables for a model, with an additional
complication of not setting the exact lag length for each variable at
the start.