help for _gwtmean

User-written egen function wtmean(), to calculate a weighted mean.

Syntax

egen [type] newvar = wtmean(exp) [if] [in]
[, weight(weightexp) by(varlist)]

Creates a constant (within varlist) containing the mean of exp.
With the weight option, it is weighted by weightexp; otherwise, it produces
an unweighted mean - the same as the egen mean function.

weightexp may be an expression (e.g., 1/prob); it is not limited to variables.

wtmean may be combined with by, either as a prefix or an option.

Author

David Kantor; email kantor.d@att.net

Please include stata in the subject field.