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 at the end of May, and its replacement, statalist.org is already up and running.


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

Re: st: calculate column sum with survey weights


From   Stas Kolenikov <skolenik@gmail.com>
To   "statalist@hsphsun2.harvard.edu" <statalist@hsphsun2.harvard.edu>
Subject   Re: st: calculate column sum with survey weights
Date   Tue, 2 Apr 2013 16:40:14 -0500

total enrollment [pw=resp_wgt]

Better yet,

svyset ...psu... [pw=resp_wgt], strata(...strata...)
svy: total enrollment

-- Stas Kolenikov, PhD, PStat (SSC)
-- Senior Survey Statistician, Abt SRBI
-- Opinions stated in this email are mine only, and do not reflect the
position of my employer
-- http://stas.kolenikov.name



On Tue, Apr 2, 2013 at 4:32 PM, Holod, Aleksandra <aholod@air.org> wrote:
>
> Hello Statalist,
>
> I would like to calculate a column total of a variable, but I need to weight the data.
>
> I am currently following this guidance in the Statalist archive: http://www.stata.com/statalist/archive/2002-08/msg00269.html,
> summ enrollment, meanonly [apply if or in as desired]
> scalar sigma = r(sum)
> di sigma
>
> How can I do this calculation with survey weights?  I added the iweight command as shown below, but is there a better way?
> summ enrollment [iweight=resp_wgt], meanonly [apply if or in as desired]
> scalar sigma = r(sum)
> di sigma
>
> Thanks,
> Alex
>
>
>
> *
> *   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/
*
*   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/


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