Hey gretl-community,

I've got a small problem with a function. Here is a small part of this function:

---------------------------------------------------------
function void adfgls (int pmx[0::1] "lag order",
    scalar crit "Critical value for initial OLS",
    list vars "List of variables to test")
   
    genr time

    loop foreach i vars
        ols $i const time $i(-1 to -pmx) --robust
        omit --auto=crit
        lis = $xlist
        check = inlist(lis, time)
    endloop

end function

open pe.gdt
scalar crit = 0.05
scalar px = 8
list X = pe price
adfgls(px, crit, X)
----------------------------------------------------------

I obtain the following error:

adfgls(px, crit, X)
'pe' is not the name of a variable
*** error in function adfgls
> ols $i const time $i(-1 to -pmx) --robust

What is wrong with the function?

Best,
Artur