On Sun, 28 Dec 2014, Daniel Bencik wrote:
Logan, thanks a lot, but e.g. with anscombe.gdt open this code
strings explainedVars = array(1)
explainedVars[1] = "x"
strings explanatoryVars = array(1)
explanatoryVars[1] = "y1(-1)"
ols @explainedVars[1] @explanatoryVars[1]
gives me the following message
Unexpected symbol '@'
Where is the problem?
The problem is that there is no string variable named "explainedVars"
(or any prefix thereof), nor is there any string variable named
"explanatoryVars".
Gretl's string substitution mechanism scans for the name of a string
variable (not the name of an array of strings) immediately following
the "@" symbol. If no such name is found an error is flagged.
As I explained in
http://lists.wfu.edu/pipermail/gretl-users/2014-December/010525.html
arrays of strings are not the right tool for the job you are trying to
do; you should use lists instead.
That said, the following works, but it is truly horrible code, not at
all recommended:
<hansl>
open data4-1
strings explainedVars = array(1)
explainedVars[1] = "price"
strings explanatoryVars = array(1)
explanatoryVars[1] = "sqft"
loop i=1..1
string depvar = explainedVars[i]
string indepvar = explanatoryVars[1]
ols @depvar const @indepvar
endloop
</hansl>
Allin Cottrell