I want to merge Dataset 1 with Dataset 2. One uses SEDOL as Identifier, the other IBES-Key, which is why I need a third Dataset that has the same IBES-Key as #2 and also the SEDOL as #1.
So far so good, but here is my Problem (with Dataset #3 for illustration)
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input str6(Ticker SEDOL) str8 Start_Date float DATE "0003" "515910" "20140220" 19774 "001V" "702510" "20140320" 19802 "001V" "702510" "20140918" 19984 "001W" "111Q10" "20140320" 19802 "001W" "111Q10" "20140417" 19830 "001W" "112W10" "20170216" 20866 "001Y" "905310" "20140417" 19830 "001Y" "905310" "20140515" 19858 "002V" "296410" "20140515" 19858 "002X" "778G10" "20140515" 19858 "002X" "778G10" "20150618" 20257 "0034" "651910" "20140515" 19858 "0034" "651910" "20141218" 20075 "0034" "653P10" "20160714" 20649 end format %td DATE
As you can see, for some - like 001V there exist multiple observations with the same SEDOL, the reason is a change in the company name which I haven't listed here.
Worse, however, is 001W were there exist two different SEDOL numbers. The company had a change in SEDOL for whatever reason. Dataset #1 however seems to use the new SEDOL in retrospect. Long story short:
How can I tell Stata to drop every observation for which there exists another observation with the same Ticker Key but "newer" date? (in the example it should drop observations 2,4,5,7,10,12,13)
I hope I could clearly illustrate my problem and that there exists a solution.. I am grateful for any help!!
Thank you in advance
0 Response to Dropping "old/updated" observations
Post a Comment