Bookmark and Share

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: weights


From   Mitch Abdon <[email protected]>
To   [email protected]
Subject   Re: st: weights
Date   Wed, 27 Oct 2010 17:26:45 +0800

hi, as maarten suggested, you can use the saved results after -sum-.
try typing "return list" after you run the -sum- command... it will
list all saved results after -sum- and what you need is r(sum), which
you can use as a local macro, eg, gen totincome=`r(sum)'

On Wed, Oct 27, 2010 at 5:20 PM, Chiara Mussida <[email protected]> wrote:
> thanks Maarten, by using sum I get the following:
>
>
> . sum hy020 [w=db090]
> (analytic weights assumed)
>
>    Variable |     Obs      Weight        Mean   Std. Dev.       Min        Max
> -------------+-----------------------------------------------------------------
>       hy020 |    2481  4012818.04    32078.65   35411.68      -4000     909798
>
> hy020 is the household disposable income. Here I have the weight (= no
> of household represented) and the mean income. How to get a total sum,
> not only for the householdin the sample, but representative for all
> household (=weight)?
>
> thanks
>
>
> On 27 October 2010 11:12, Maarten buis <[email protected]> wrote:
>> --- On Wed, 27/10/10, Chiara Mussida wrote:
>>> I have to generate a variable for the sum of household
>>> disposable income and I must use the available weights to
>>> get the real sum. Anyway the commands gen and egen (for a
>>> sake of clarity I used egen newvar=sum(income)) do not
>>> allow the use of weights.
>>
>> Why not just use -summarize- or -total-? These allow for
>> weights and leave the sum behind in the returned results.
>>
>> Hope this helps,
>> Maarten
>>
>> --------------------------
>> Maarten L. Buis
>> Institut fuer Soziologie
>> Universitaet Tuebingen
>> Wilhelmstrasse 36
>> 72074 Tuebingen
>> Germany
>>
>> http://www.maartenbuis.nl
>> --------------------------
>>
>>
>>
>>
>>
>> *
>> *   For searches and help try:
>> *   http://www.stata.com/help.cgi?search
>> *   http://www.stata.com/support/statalist/faq
>> *   http://www.ats.ucla.edu/stat/stata/
>>
>
>
>
> --
> Chiara Mussida
> PhD candidate
> Doctoral school of Economic Policy
> Catholic University, Piacenza (Italy)
>
> *
> *   For searches and help try:
> *   http://www.stata.com/help.cgi?search
> *   http://www.stata.com/support/statalist/faq
> *   http://www.ats.ucla.edu/stat/stata/
>



-- 
Best,
Mitch


Arnelyn May Abdon
Mobile: +63 9178034402
http://statadaily.wordpress.com

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index