Thanks a lot Prof.Lucchetti.
With regards,
Dr.K.Dhanasekaran
On Sun, 2 Apr 2023 at 5:44 PM, Riccardo (Jack) Lucchetti <
p002264(a)staff.univpm.it> wrote:
On Sun, 2 Apr 2023, Dhanasekaran Kuppusamy wrote:
> Dear Gretl Experts,
>
>
> I worked with a sample consisting of 6
> regions (1,2,……,6) with 2 areas (1 &2) and thus, a total of 12
> sub-samples. But only 11 subsamples are available for estimation. I used
> the following loop for the estimation. For all the 12 sub-samples (if
> available) the following loop works well. When one sub- sample is
> unavailable, I used the following code and got the message “No
> observations would be left!”.
The problem is that the "smpl" command yields an error if the condition is
false for all observations. The cleanest way out IMO is to wrap the
relevnt code inside an "if" statement, as in
<hansl>
discrete Region
discrete Area
loop i=1..6 # Six Regions
loop j=1..2 # Two areas
cond = sum( (&Region==i) && (Area==j) )
if cond
smpl (&Region==i) && (Area==j) --restrict
[Code Block]
smpl full
endif
endloop
endloop
</hansl>
There are marginally more efficient ways to accomplish the same result,
but this one is quite simple and should work ok in your case.
-------------------------------------------------------
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
-------------------------------------------------------_______________________________________________
Gretl-users mailing list -- gretl-users(a)gretlml.univpm.it
To unsubscribe send an email to gretl-users-leave(a)gretlml.univpm.it
Website:
https://gretlml.univpm.it/postorius/lists/gretl-users.gretlml.univpm.it/