Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down on April 23, and its replacement, is already up and running.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: st: use egen functions to get survey weighted means

From   Nick Cox <>
Subject   Re: st: use egen functions to get survey weighted means
Date   Fri, 30 Nov 2012 19:33:27 +0000

You are correct in your guess. -egen- does not support weights of any
kind and it does not support -svy:-, or vice versa.

More positively, your example implies a single mean, so -svy: mean-
should work. The result will be a constant, so no need to think that
you are creating a new variable.


On Fri, Nov 30, 2012 at 7:16 PM, HUANG, LILING <> wrote:

> I would like to creates a new variable that contains survey weighted mean estimates of one variable. The egen command does not seem to support such a function. Could you please let me know how to get this resolved?
> . egen meanrank = svy:mean(rank) if x==1 & y==1 & z==1
> unknown egen function svy:mean()
*   For searches and help try:

© Copyright 1996–2015 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index