[Gretl-users] Passing a list of series to a function

Riccardo (Jack) Lucchetti r.lucchetti at univpm.it
Mon Jul 29 17:43:46 EDT 2013


> Thanks Jack,
>
> This is not quite the problem I am having.
>
> string ddat = varname(lstDIV[1])
>
> works fine. lstDIV[1] returns the series ID # of the 
> first element on lstDIV. So I have no problem getting the name of the 
> series. I am having trouble getting series within the scope of the 
> function. I can approach the problem another way, namely by using 
> bundles, but I was hoping to keep this function as simple as possible.
>
> What I am doing is passing a list of series to be included in a 
> multiplot figure.

Oh, I see what you mean now. Here's a minimal modification to your 
function that should work.

<hansl>
function void dplot(list lstDIV, string filetype,
                     string strTitle[null], string strDisc[null])
     string ddat = varname(lstDIV[1])
     sprintf send "%s", date(firstobs(lstDIV. at ddat))

     printf "%s\n", send
end function
</hansl>

Be sure to have a look at the "List arguments" subsection in section 11.4 
of the User's Guide.

-------------------------------------------------------
   Riccardo (Jack) Lucchetti
   Dipartimento di Scienze Economiche e Sociali (DiSES)

   Università Politecnica delle Marche
   (formerly known as Università di Ancona)

   r.lucchetti at univpm.it
   http://www2.econ.univpm.it/servizi/hpp/lucchetti
-------------------------------------------------------


More information about the Gretl-users mailing list