Hi Jack,
Even if I do that, the user has to define his workdir before I can load mymodel.gdt. They
have it very likeley in some random folder, so I can't use the default workdir.
So, I can't first load the model, then ask the user to define workdir, it wouldn't
make much sense.
Anyway, thanks for reminding me about include, I'll use it extensively to hide my
crappy scripting :D
________________________________
De: Riccardo (Jack) Lucchetti <p002264(a)staff.univpm.it>
Enviado: lunes, 22 de marzo de 2021 21:28
Para: Gretl list <gretl-users(a)gretlml.univpm.it>
Asunto: [Gretl-users] Re: Defining a list of series before series are loaded, is it
possible?
On Mon, 22 Mar 2021, Sven Schreiber wrote:
Am 22.03.2021 um 21:47 schrieb Iago Varela:
> Hi all, I'm Yago again.
>
> So I'm struggling with a new thing.
>
> The script I'm writing asks the user to imput at the very top what
> variables will be used as dependent and regressors for a logit model. I
> wanted to put it at the top so any user imput is close and neat, and
> there's no skim through code necessary.
>
> The problem is that I can't make a list before I have a dataset, I can't
> make a list for series that are not defined before such list.
Hi, I don't understand what the problem is. You can write anything like:
list reg = x y z
in a script even with no dataset loaded, and no series "x", "y",
"z"
present. Of course it won't _work_ before you load the data, but that's
expected and cannot be avoided.
So surely you're trying to achieve something different? Maybe a more
concrete code example would help us understand.
I guess that Yago's intention is to write a script in which somebody else
will modify the definition for the list but, the actual read of the
dataset will take place later on. This is somehow odd. My suggestion is to
use "include" for that, grouping all statements the end user is not
supposed to touch in another file. For example: imagine that the file
"foo.inp" contains the lines
<foo.inp>
set verbose off
open mroz87.gdt --quiet
series lWW = log(WW)
</foo.inp>
then you can give your user a file "bar.inp" with the following lines
<bar.inp>
include foo.inp # don't touch!
list X = const WA WE AX
ols lWW X
</bar.inp>
Would this help?
-------------------------------------------------------
Riccardo (Jack) Lucchetti
Dipartimento di Scienze Economiche e Sociali (DiSES)
Università Politecnica delle Marche
(formerly known as Università di Ancona)
r.lucchetti(a)univpm.it
http://www2.econ.univpm.it/servizi/hpp/lucchetti
-------------------------------------------------------