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
-------------------------------------------------------