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@univpm.it
http://www2.econ.univpm.it/servizi/hpp/lucchetti
-------------------------------------------------------