Thanks, for all the answers.
Actually, I was interested in a way to get the mean of a variable in a 
subsample using a single command (without using smpl).
However, Sven and Allin's answers intrigue me: how do you insert the 
partial flag in the mean function?
For example: mean (x, ...
Thank you,
Paolo
Il 27/09/2022 14:20, Cottrell, Allin ha scritto:
 On Tue, Sep 27, 2022 at 5:22 AM Riccardo (Jack) Lucchetti
 <p002264(a)staff.univpm.it> wrote:
> On Tue, 27 Sep 2022, Paolo Chirico wrote:
>
>> Dears,
>> in function reference about /mean/ function there is :
>> Arguments: /x  (series or list)//
>> //        partial  (boolean, optional)/
>>
>> Can you give me an example including /*partial*/ (a boolean condition),
>> please?
>> Does this mean that I can calculate the mean of a variable in a subsample
>> (defined by a boolean condition) without using the *smpl *command?
> For example:
>
> <hansl>
> open mroz87
> m = mean(WA) # overall mean age
> me = mean(LFP ? WA : NA) # mean age for employed women only
> </hansl>
 Yes, the suggestion above works fine without the "partial" flag (NAs
 are automatically ignored in calculating the mean of a single series).
 The effect of the "partial" flag is more complex: it applies if the
 first argument is a list rather than a series, in which case the value
 returned is a series holding the cross-sectional mean at each
 observation. In that case the partial flag is needed if you want to
 ignore NAs in each cross section.
 Allin
 _______________________________________________
 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/ 
-- 
Paolo Chirico
Università del Piemonte Orientale
Dip. di Giurisprudenza e Scienze Politiche,
Economiche e Sociali (DIGSPES)
Alessandria, Italia