Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Event Study: Moving days from holidays/ weekends onto next trading day

    Hello Stata Community,

    I have an unbalanced data set containing stock returns and developed a business calendar for it. Now I merged additional data to it containing event dates which some of them are not entailed in the business calendar (eg. weekends or holidays). Is there any way to tell Stata to move those data points onto the next trading day in order to match a stock return to the new data points?


    Thank you in advance,
    Marie

  • #2
    I found a hint online http://www.stata.com/features/overvi...ess-calendars/ which suggests using the following code :

    Code:
    tomorrow=Date+1
    Since my Date variable is already defined as a %tb variable, it should omit Weekends and Holidays and directly skip to the next trading day. However, for my data set it just adds another day to it as the code would suggest without knowing that Date is defined based on a business calendar.

    What I have done after merging the two data sets:

    Code:
    drop if _merge==1
    drop if _merge==3
    replace Date=Date + 1
    Now, I would want to merge it back onto the original data set because the missing dates would be filled but since I do not get the correct Date in the first place which would match with the orginal data set, I am currently stuck.

    Any help is very appreciated

    Marie

    Comment


    • #3
      One last thing of information, I designed my business calendar on the dates I had available in the original dataset like that :

      Code:
      bcal create tcal, from(Date)
      format %tbtcal:DD/NN/CCYY Date
      generate bcaldate = bofd("tcal",Date)

      Comment

      Working...
      X