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]
st: Weighted summing in a loop for members of a group
From
Timm Klare <[email protected]>
To
[email protected]
Subject
st: Weighted summing in a loop for members of a group
Date
Wed, 23 Mar 2011 18:15:17 +0100
Hello everybody,
I would appreciate your help in solving the following problem. I work
on a dataset containing balance sheet and other information about a
couple of million European companies (AMADEUS). The data relevant to
my current problem is made up of the following variables:
GROUP_PARENT NUM_ID YEAR TOTAL_ASSETS GROUP_TOTAL_ASSETS TAXRATE
NUM_ID is the unique ID of each company and GROUP_PARENT is the ID of
the parent company for each group of companies. 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? I tried using a foreach loop but failed.
Thanks for your consideration
Timm
*
* 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/