Dear Allin,
I thought I found such example in the first message:
open denmark.gdt
series LRY_LRM = IBO
Head of LRY_LRM :
LRY_LRM
1974:1 0.1547356
1974:2 0.1779912
list x = LRY LRM
square(x,1)
new head of LRY_LRM:
LRY_LRM
1974:1 68.67460
1974:2 68.16070
rename does the check but square overwrites
Oleh
23 вересня 2016, 21:20:43, від "Allin Cottrell" <cottrell(a)wfu.edu>:
On Fri, 23 Sep 2016, oleg_komashko(a)ukr.net wrote:
> Dear all,
> Gretl have several possibilities for creating
> of large numbers of new variables with autonames:
> square(list)/ square list
> list^list
> dummify(discreteVar)
> etc.
> Below is the script to illustrate the problem
> open denmark.gdt
>
> sq_LRM = IBO/IDE
>
> # Descriptive label-> IBO/IDE
>
> square LRM
>
> # Descriptive label-> = LRM squared
>
> series LRY_LRM = IBO
>
> # Descriptive label-> IBO
>
> list x = LRY LRM
>
> square(x,1)
>
> # Descriptive label of LRY_LRM -> LRY times LRM
>
> With denmark.gdt everything is obvious
> But what if we work with a large data set
> with hundreds of variables and hundreds of
> new dummies and interactions some replacements
> can be easily overlooked
> I think there should be some tools to prevent
> casual rewriting variables
> May be a precheck function to find possible name
> duplicating or rename() to rename variables having
> underscore in names: this will prevent duplicating,
> since all autonames contain '_'
> I'll be glad for opinions
First point: we have a "rename" command, and it can be used for
mass-renaming of series whose names contain an underscore. Here's a
simple illustration:
open data4-10
list D = dataset
list D print
list L = logs(D)
list L print
loop foreach i L -q
string orig = "$i"
string newname = strsub(orig, "_", "")
rename @orig @newname
endloop
list L print
Second point: we do have some code in place to try to ensure that we
don't overwrite existing series by the operations that create a list
of new, auto-named series (we modify the auto-name to avoid
collisions). I can't guarantee, offhand, that this mechanism is
always employed when it should be, or if it's employed that it
always works as intended. However, if we let the null hypothesis be
that it always works fine, do you have evidence to the contrary?
Allin
_______________________________________________
Gretl-devel mailing list
Gretl-devel(a)lists.wfu.edu
http://lists.wfu.edu/mailman/listinfo/gretl-devel