[Gretl-devel] members of lists returned from functions

Riccardo (Jack) Lucchetti r.lucchetti at univpm.it
Mon Feb 11 17:26:57 EST 2008


On Mon, 11 Feb 2008, Allin Cottrell wrote:

> But what about successive invocations:
>
> logs xlist
> logs zlist
>
> where xlist and zlist contain long names that will yield
> "cross-conflicting" log names, so to speak?  Under the new
> proposal as it stands, some of the logs created by the first
> command would be overwritten (I think).

And rightly so, if you ask me. Now, we may consider raising VNAMELEN to 
24 or 32 to minimise the chances of this happening, but then formatting 
the output of estimation commands becomes a problem. The Stata guys 
solved this issue by truncating variable names on output, using 
reasonable conventions. Example:

. regress very_long_identifier_y very_long_identifier1 very_long_identifier2

       Source |       SS       df       MS              Number of obs =     753
-------------+------------------------------           F(  2,   750) =   45.82
        Model |  860.569119     2  430.284559           Prob > F      =  0.0000
     Residual |  7042.54159   750  9.39005546           R-squared     =  0.1089
-------------+------------------------------           Adj R-squared =  0.1065
        Total |  7903.11071   752  10.5094557           Root MSE      =  3.0643

------------------------------------------------------------------------------
very_long_~y |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
very_long~_1 |  -.1177097   .0467719    -2.52   0.012     -.209529   -.0258903
very_long_~2 |   .5480657    .061962     8.85   0.000     .4264261    .6697053
        _cons |  -2.889082    .623721    -4.63   0.000    -4.113529   -1.664636
------------------------------------------------------------------------------

Perhaps we could do the same.

> But maybe worrying about this falls into the category of trying a
> little too hard to stop users from shooting themselves in the
> foot.
>
> We can ensure the docs are clear on this point, and leave it up to
> the user to use variable names of a sane length. Maybe also print
> a message when an existing variable is redefined via an
> auto-naming command/function.

I heartily agree.


Riccardo (Jack) Lucchetti
Dipartimento di Economia
Università Politecnica delle Marche

r.lucchetti at univpm.it
http://www.econ.univpm.it/lucchetti


More information about the Gretl-devel mailing list