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: Weighted summing in a loop for members of a group


From   Maarten buis <[email protected]>
To   [email protected]
Subject   Re: st: Weighted summing in a loop for members of a group
Date   Wed, 23 Mar 2011 17:27:51 +0000 (GMT)

--- On Wed, 23/3/11, Timm Klare wrote:
> For each NUM_ID and YEAR I need to calculate an new
> variable. It should sum the asset-weighted tax rate
> differences between each NUM_ID YEAR and all other
> companies in each group:
> 
> (sigma sign) (TAXRATE[NUM_ID] –
> TAXRATE[i])*(TOTAL_ASSETS[i]/GROUP_TOTAL_ASSETS)
> 
> Where i corresponds to all other companies in the observed
> group. How can this be done? Is there a “sigma sign” like
> summing function in STATA? 

Looks like an -egen- problem in combination with -by-,
see -help egen- (in particular the -total()- function) and
-help by-.

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/


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