Hi,
I want to merge two datasets for my event study. One file consists of the stock return date (for every company_id over the period 01feb2005 until 01aug2016) and the other one consists of event date (but also includes important variables I do not want to lose). Companies can have multiple events, therefore, I want to use two key variables for merging: company_id and date.
The stock return dataset looks like:
----------------------- copy starting from the next line -----------------------
------------------ copy up to and including the previous line ------------------
The eventdates dataset looks like:
----------------------- copy starting from the next line -----------------------
------------------ copy up to and including the previous line ------------------
How can I merge these two datasets and preserve all the stock return dates where no event occurs?
Thank you
I want to merge two datasets for my event study. One file consists of the stock return date (for every company_id over the period 01feb2005 until 01aug2016) and the other one consists of event date (but also includes important variables I do not want to lose). Companies can have multiple events, therefore, I want to use two key variables for merging: company_id and date.
The stock return dataset looks like:
----------------------- copy starting from the next line -----------------------
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input float date str12 company_id 16468 "AEA000201011" 16469 "AEA000201011" 16470 "AEA000201011" 16471 "AEA000201011" 16474 "AEA000201011" 16475 "AEA000201011" end format %td date
The eventdates dataset looks like:
----------------------- copy starting from the next line -----------------------
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input int date str12 company_id 20298 "AEA000201011" 20663 "AEA000201011" 20207 "AEA001501013" 20571 "AEA001501013" 20006 "AEA002001013" 20355 "AEA002001013" 20720 "AEA002001013" 19823 "AEA002401015" end format %td date
How can I merge these two datasets and preserve all the stock return dates where no event occurs?
Thank you
Comment