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: Event-Study Cumulative Abnormal Return(CAR)


From   Nick Cox <njcoxstata@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: Event-Study Cumulative Abnormal Return(CAR)
Date   Tue, 26 Feb 2013 10:37:12 +0000

You could use -egen, tag()- to identify just one observation for each
distinct value

egen tag = tag(dif)
gen sum_once = sum_for_each_day if tag



On Tue, Feb 26, 2013 at 8:34 AM, Künzel Sven
<s.kuenzel@tu-braunschweig.de> wrote:
> Thanks for your help.
>
> The syntax I tried used the forvalues command but your syntax seems to be
> much easier.
>
> I have just one more question. By using the syntax
>
>
> egen sum_for_each_day = total(abnormal_return), by(dif)
>
> I have the sum for each day for every group_id (see the data below) but i
> would like to have it just once (see the older post). Is there an additional
> option?
>
>
>
> countrynam spreads  group_id    datum      event_date    dif event_window
> abnormal_return    sum_for_each_day
>
> Portugal     0.30     1       21dec2010     23dec2010    -2      0
> 0.5
> Portugal     0.33     1       22dec2010     23dec2010    -1      1
> 0.6                1.75=0.6+0.05+1.1
> Portugal     0.32     1       23dec2010     23dec2010     0      1
> 0.5                1.80=0.5+0.10+1.2
> Portugal     0.33     1       27dec2010     23dec2010     1      1
> 0.6                2.05=0.6+0.15+1.3
> Portugal     0.35     1       28dec2010     23dec2010     2      0
> 0.4
>
> Ireland      0.20     2       20oct2009     22oct2009    -2      0
> 0.1
> Ireland      0.21     2       21oct2009     22oct2009    -1      1
> 0.05               1.75=0.6+0.05+1.1
> Ireland      0.20     2       22oct2009     22oct2009     0      1
> 0.1                1.80=0.5+0.10+1.2
>
> Ireland      0.19     2       23oct2009     22oct2009     1      1
> 0.15
> Ireland      0.24     2       24oct2009     22oct2009     2      0
> 0.2
>
> Italy        0.26     3       04oct2010     06oct2010    -2      0
> 1.2
> Italy        0.29     3       05oct2010     06oct2010    -1      1
> 1.1                1.75=0.6+0.05+1.1
> Italy        0.31     3       06oct2010     06oct2010     0      1
> 1.2                1.80=0.5+0.10+1.2
> Italy        0.26     3       07oct2010     06oct2010     1      1
> 1.3                2.05=0.6+0.15+1.3
>
> Italy        0.25     3       08oct2010     06oct2010     2      1
> 1.1
>
>
> Sven
>
>
>
> On Mon, 25 Feb 2013 21:38:11 +0000
>  Nick Cox <njcoxstata@gmail.com> wrote:
>>
>> Your calculations seem to require
>>
>> egen sum_for_each_day = total(abnormal_return), by(dif)
>>
>> We can't comment on what you tried and don't show us.
>>
>> Nick
>>
>> On Mon, Feb 25, 2013 at 9:08 PM, Künzel Sven
>> <s.kuenzel@tu-braunschweig.de> wrote:
>>
>>> I was wondering if you can help me. I am trying to analyse my datasample
>>> by
>>> using an Event-Study. Now I would like to get a cumulative sum of the
>>> abnormal return for each day around the event-date. At the End I would
>>> like
>>> to have a variable where I can see the sum for each day around the event.
>>> My
>>> data looks like this:
>>>
>>>
>>>
>>> new variable I need
>>> countrynam spreads  group_id    datum      event_date    dif event_window
>>> abnormal_return    sum_for_each_day
>>>
>>> Portugal     0.30     1       21dec2010     23dec2010    -2      0
>>> 0.5
>>> Portugal     0.33     1       22dec2010     23dec2010    -1      1
>>> 0.6                1.75=0.6+0.05+1.1
>>> Portugal     0.32     1       23dec2010     23dec2010     0      1
>>> 0.5                1.80=0.5+0.10+1.2
>>> Portugal     0.33     1       27dec2010     23dec2010     1      1
>>> 0.6                2.05=0.6+0.15+1.3
>>> Portugal     0.35     1       28dec2010     23dec2010     2      0
>>> 0.4
>>>
>>> Ireland      0.20     2       20oct2009     22oct2009    -2      0
>>> 0.1
>>> Ireland      0.21     2       21oct2009     22oct2009    -1      1
>>> 0.05
>>> Ireland      0.20     2       22oct2009     22oct2009     0      1
>>> 0.1
>>> Ireland      0.19     2       23oct2009     22oct2009     1      1
>>> 0.15
>>> Ireland      0.24     2       24oct2009     22oct2009     2      0
>>> 0.2
>>>
>>> Italy        0.26     3       04oct2010     06oct2010    -2      0
>>> 1.2
>>> Italy        0.29     3       05oct2010     06oct2010    -1      1
>>> 1.1
>>> Italy        0.31     3       06oct2010     06oct2010     0      1
>>> 1.2
>>> Italy        0.26     3       07oct2010     06oct2010     1      1
>>> 1.3
>>> Italy        0.25     3       08oct2010     06oct2010     2      1
>>> 1.1
>>>
>>>
>>> I tried different things but couldn´t find any fitting syntax. Can you
>>> help
>>> me?
>>
>>
>> *
>> *   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/

*
*   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