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: RE: merging observations in one dataset
From
Eric Booth <[email protected]>
To
"<[email protected]>" <[email protected]>
Subject
Re: st: RE: merging observations in one dataset
Date
Tue, 31 Aug 2010 19:51:25 +0000
<>
See http://www.stata.com/support/faqs/res/statalist.html#toask about attachments being prohibited.
In your ods example2, you are adding together the assets and capital for by quarter and company (that is, you add together bank1 and bank3 in quarter1 because they are both owned by companyX), but you apply the summed assets and capital to Bank1 even though this is not just Bank1's assets/capital. I suspect that Bank is meaningless at this point, so you can drop it after you sum by quarter & company, so:
**********!
clear
inp Bank Quarter Assets Capital_Holding str2(company)
1 1 324532 8768 x
1 2 433243 787686 x
1 3 34234 7686 x
2 1 643363 67867 y
2 2 465346 68678 y
2 3 54363 76868 y
3 1 4636436 7678768 x
3 2 463346 7686876 x
3 3 5325345 788768 x
end
foreach v in Assets Capital_Holding {
bys company Quarter: egen `v'2 = total(`v')
drop `v'
rename `v'2 `v'
}
drop Bank
duplicates drop
**********!
~ Eric
On Aug 31, 2010, at 2:36 PM, David Kehrl wrote:
> sorry again here is the before and after example
>
>
> 2010/8/31 David Kehrl <[email protected]>:
>> sorry,here an example,
>> what i want now is to sum all balance sheet variables (in this case
>> assets and capital) at the holding company level.Hope this is more
>> clear.
>>
>>
>>
>> Bank ID Assets Securities Quarter Holding
>>
>> 2010/8/31 Nick Cox <[email protected]>:
>>> Merge, aggregate, sum: You are sending conflicting signals. I suggest a worked example showing exactly what you want, before and after. It can be hypothetical; all that is needful is that it be clear.
>>>
>>> Nick
>>> [email protected]
>>>
>>> David Kehrl
>>>
>>> I am working with a panel data set containing quarterly data on
>>> balance sheet items for all american banks. I am trying to aggregate
>>> the bank level data for banks with common ownership . I have a string
>>> variable indicating the highest holding company level. my question is
>>> how is it possible to sum those banks with common ownership.
>>>
>>> *
>>> * 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/
>>>
>>
> <example2.ods>
*
* 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/