[Gretl-devel] Ignacio's tramo script

Allin Cottrell cottrell at wfu.edu
Thu Jan 25 08:57:59 EST 2007


On Thu, 25 Jan 2007, Ignacio Díaz-Emparanza wrote:

> I was trying to debug my script and I am surprised that even this simple
> script gives an error now:
>
> ---------
> function tramolin(list xlist, scalar year, scalar startp)
> genr ser = time
> #! cmd /c "del /Q tmp_descript"
> # list retlist = null
> # scalar nobser = $nobs
> end function
> open data9-9
> list xlist2 = nocars Y pop
> list adjlist = tramolin(xlist, 1976, 1)

> ? list adjlist = tramolin(xlist, 1976, 1)
> Data types not conformable for operation

I take it you actually typed "xlist2" for the first argument to 
tramolin (otherwise you would have got a different error
message).

The error message is correct, if not quite as informative as it 
might be: you're trying to assign to "adjlist" from a function 
that doesn't return anything.

In addition "genr ser = time" won't work.  You can say

genr time
genr ser = time

(Perhaps "genr ser = time" ought to work, but it's not claimed to 
work.)

Note that for debugging a function, you should do

   set echo on
   set messages on

inside the function.

Allin.


More information about the Gretl-devel mailing list