Dear gretl users,

I am struggling with the following problem:

<hansl>
set echo off
set messages off
open denmark
list ttt = LRM LRY
scalar vars = nelem(ttt)
varnames = varname(ttt)

loop i=1..vars                                             #I need to run a loop over the sequence 1 to vars...
    print "$i"                                                 #because simply assume I want to print number $i
    sprintf astr$i "%s", varnames($i)            #And I need to generate a string astr$i with the name of the i'th series in list ttt, but I dont know how to access it
   printf "%s", @astr$i                               
endloop
<\hansl>

I already know how to obtain a string with the variables name using the 'foreach'-loop but this does not help in my case:

<hansl>
set echo off
set messages off
loop foreach i ttt
    sprintf astr "%s", "$i"
    print astr
endloop
<\hansl>

Does anybody know a solution to this issue?

Thanks in advance!

Artur