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