Henrique,
Try this
function strings varnames(list in)
#Returns an array of strings containing the names of each variable in a list
catch strings ret = strsplit(strsub(varname(in),","," "))
if $error != 0
strings ret
string errormesage = errmsg($error)
print errormesage
endif
return ret
end function
This function returns the names of the variables as an array of strings.
Logan
From: gretl-users-bounces@lists.wfu.edu [mailto:gretl-users-bounces@lists.wfu.edu]
On Behalf Of Henrique Andrade
Sent: Thursday, February 05, 2015 7:47 AM
To: Gretl Discussion List (users)
Subject: [Gretl-users] How to retrieve a list's element name
Dear Gretl Community,
I need to retrieve a name of a specific element from a list and use it as a string. I tried the following commands:
<hansl code>
open australia.gdt
list L = PAU PUS E
string S = varname(varnum(L[2]))
</hansl code>
Best,
Henrique Andrade