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: standard deviation around an event


From   Nick Cox <[email protected]>
To   "[email protected]" <[email protected]>
Subject   Re: st: standard deviation around an event
Date   Tue, 30 Jul 2013 12:29:20 +0100

There are various ways round this in Stata; I don't know about STATA.
This is quick to code and slow to run. Some other methods require more
code but would be faster. I tackled your first problem only.

gen sd = .

forval i = 1/`=_N' {
            if shareissue[`i'] == 1 {
             su earnings if firmid==firmid[`i'] & _n != `i' &
inrange(year, year[`i'] -4, year[`i'] + 4)
             replace sd = r(sd) in `i'
          }
}

See also

SJ-7-3  pr0033  . . . . . . . . . . . . . .  Stata tip 51: Events in intervals
        . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  N. J. Cox
        Q3/07   SJ 7(3):440--443                                 (no commands)
        tip for counting or summarizing irregularly spaced
        events in intervals

http://www.stata-journal.com/sjpdf.html?articlenum=pr0033

Nick
[email protected]


On 30 July 2013 12:09, Khieu, Hinh <[email protected]> wrote:

> I have a panel unbalanced data (firm ID, year, share issue year dummy, earnings). I need to calculate the standard deviation of earnings four years before share issue year and four years after share issue year. (I do not have the precise day and month of share issues; I only have year). I can certainly require my data have at least 9 consecutive observation years. That is, the standard deviation cannot include the year of the share issue. I do not know how to exclude that year from the standard deviation in STATA. Also, another problem is that sometimes firm can issue shares two or three years in a row.  In this case, I need to use only the four years before the first issue and the four years after the last consecutive share issue to calculate the standard deviation of earnings.

*
*   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–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index