On Mon, 8 Sep 2008, Gordon Hughes wrote:
At the beginning of August I reported a problem that I had
encountered with use of the smpl and setobs commands inside
functions. From the change log for Version 1.7.7 (items 4 & 5)
I had understood that this problem had been corrected in the new
version, but I have not had time to test it before now. Sadly,
my test scripts still fail in the same way as before.
To recap briefly. My function is designed to deal with
unbalanced panel data, whereas Gretl's standard panel functions
insist on balanced panel data. It proceeds as follows: (a)
check that the data supplied is panel data, (b) extract the
panel & time ids to new variables, (c) define the data as cross
section and drop cases with missing values, (d) carry out the
function estimation, (e) attempt to reset sample to the full
data supplied (smpl full), (f) redefine the data as panel data
using the panel & time ids extracted in step (b).
This works as intended when it is supplied with my full test
dataset. However, the program falls over in this final step,
reporting that missing values were encountered, when the sample
is restricted before the function is called...
Try dropping steps (e) and (f). When the function exits, the
original panel interpretation and sample range will be established
automatically.
In principle, gretl should be robust with respect to your attempt
to do this manually inside the function, but it is very tricky.
You're right, there was a remaining bug whereby "smpl full" inside
a function could re-establish too big a range (bigger than
supplied on entry to the function) under certain conditions. But
even with this fixed what you're trying (the "setobs --panel-vars"
command, that is) won't work, since the "time" and "unit"
variables you're creating inside the function are not full-length.
Allin.