Announcement

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

  • Merging datasets & Business calendar

    Dear all,

    A few days ago I posted the following message:

    "I currently have one dataset with IPO data for a specific sample of firms and sample period. Among these data I have the lockup expiration dates and I want to calculate cumulative abnormal returns for a time frame 3 days before and 3 days after. I have obtained the returns from CRSP and currently have them in another dataset. Nevertheless I have thousands of returns for each firm covering the whole sample period while I only need the returns from t=-3 to t=+3. So I want to ask how I can merge the two datasets keeping only the returns I am interested in (the ones around the lockup expiration dates)."

    I used a code that a statalist member suggested:
    use "IPO data", clear
    expand 7
    generate int return_date = lockup_expiration_date // name of date variable in "returns from CRSP" dataset
    bysort firm_id: replace return_date = return_date + (_n - 4)
    merge 1:1 firm_id return_date using "returns from CRSP", assert(match using) keep(match)

    The code works but I have a problem with missing values due to the fact that CRSP offers data for stock returns only for trading dates (not weekends or holidays during which stock exchanges are not open). I know that I have somehow to make a conversion to a business calendar and I have read manuals but it seems rather complicated considering that I have somehow to incorporate this new requirement into the above-mentioned code. So eg Stata should not include weekends in my event window for each firm but move to the previous or next working day.

    Could someone possible provide the code I need combined with the above-mentioned code? I am a new Stata user so I really need help with the steps and the code.

    Thank you all in advance,
    Natalia Tsorapi
    Last edited by Natalia Tsorapi; 22 Sep 2014, 07:46.

  • #2
    This appears to allude to this thread

    http://www.statalist.org/forums/foru...rging-datasets

    It's good practice, here as indeed anywhere on the internet, to give explicit cross-references.



    Comment


    • #3
      Yes thank you for your comment you are right. I am new in Statalist so any kind of these comments are always welcome.

      Comment


      • #4
        You can try this page, it helps in answering all such questions
        HTML Code:
        http://dss.princeton.edu/online_help/stats_packages/stata/eventstudy.html#clean
        Regards
        --------------------------------------------------
        Attaullah Shah, PhD.
        Professor of Finance, Institute of Management Sciences Peshawar, Pakistan
        FinTechProfessor.com
        https://asdocx.com
        Check out my asdoc program, which sends outputs to MS Word.
        For more flexibility, consider using asdocx which can send Stata outputs to MS Word, Excel, LaTeX, or HTML.

        Comment


        • #5
          Yes I have already seen that. Thank you very much for your help!

          Comment

          Working...
          X