Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: st: use egen functions to get survey weighted means
From
Austin Nichols <[email protected]>
To
[email protected]
Subject
Re: st: use egen functions to get survey weighted means
Date
Fri, 30 Nov 2012 15:27:12 -0500
LILING <[email protected]>:
ssc inst _gwtmean
egen m=wtmean(rank), by(x y z) weight(wt)
On Fri, Nov 30, 2012 at 3:08 PM, HUANG, LILING <[email protected]> wrote:
> Nick, Thank you very much for prompt response to my inquiry. But I do need a new variable to get the mean constants that result from a variety of conditions by the statement if x==1 & y==1 & z==1 (e.g., x==1 & y==2 & z==2). I was struggling with this and doing it in a hard way by generating each new variable for each if statement and trying to use replace command to collect all the means from these variables into one final variable. But when I tried to get weighted means and found that egen does not support svy:means. Is there an easier way to get this done? I looked up the past thread and learned to use the matrix means = e(b) and svmat means commands to get the weighted means. But I cannot quite figure out how to achieve what I want to get out of my data in an easy way.
>
> Liling
*
* For searches and help try:
* http://www.stata.com/help.cgi?search
* http://www.stata.com/support/faqs/resources/statalist-faq/
* http://www.ats.ucla.edu/stat/stata/