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:
<hansl>
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
</hansl>
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