Am 01.03.2022 um 21:21 schrieb Allin Cottrell:
On Tue, 1 Mar 2022, Sven Schreiber wrote:
> The point here is that the samplecheck function should only get
the
> restricted active sample from the outer scope (right?)
No, the function only gets regular _access_ to the restricted range, but
it still "knows" the full data range.
OK, good.
The problem exposed by check2() lies in libgretl's automatic
compounding
of a "--unit" style restriction with a regular --restrict. It works fine
if you compound them manually in a single command:
? smpl $unit == 5 and dates < 20010101 --restrict
Full data set: 1708 observations
Current sample: 40 observations
Right, verified that that is a workaround for my problem, thanks. (After
doing a "smpl full" before; alternatively I guess adding --replace would
also work, but haven't explicitly tested that.)
But anyway, you're right, more work is needed in this area.
Let me repeat -but now explicitly- the code that lets gretl crash, as
this is probably the most important case:
<hansl>
# assuming checkdata.gdt is loaded...
smpl full
setobs 4 1991:1 --panel-time
smpl 1991:1 2017:4 --time # n = 1512
function void check2 (series x)
series dates = $obsdate
smpl 5 5 --unit
smpl 1991:1 2000:4 --time
smpl
end function
check2(UKIB)
</hansl>
thanks
sven