On Fri, 10 Oct 2014, henrique.andrade(a)bb.com.br wrote:
Dear Gretl Team,
I'm trying to define sample ranges inside a "big" Hansl script using
strings. Please take a look at the following code:
<code>
open australia.gdt
string data0 = "1980:4"
string data1 = obslabel(lastobs(PUS)-10)
string data2 = obslabel(lastobs(PUS))
string def_erro = "4"
smpl obsnum(@data2)-@def_erro ; # Ok!
smpl full
smpl ; obsnum(@data2) # Doesn't work
smpl full
smpl obsnum(@data2)-@def_erro obsnum(@data2) # Doesn't work
print "Hello, World!"
</code>
The problem only happens with Gretl 1.10.0 (I think it is a problem related
to the new parser).
The business of allowing the evaluation of expressions within the
"smpl" command is, so to speak, only "by courtesy": this is not a
full-blown functions-with-arguments environment.
In this context you are much better off not mucking about with
strings (still less with @-style string substitution). Here's your
example rewritten in a much simpler and more reliable form:
<hansl>
open australia.gdt
scalar data2 = lastobs(PUS)
scalar def_erro = 4
smpl data2-def_erro ;
smpl full
smpl ; data2
smpl full
smpl data2-def_erro data2
print "Hello, World!"
</hansl>
That said, I'll take a look at the difference in behaviour between
the last 1.9.92 and 1.10.0cvs.
Allin