First and foremost, this is my first post here so hello everyone and look forward to being a part of the community!
To my problem:
I am currently working with two datasets, one comprising of data on executive compensation (option awards) and another with various financial data on those CEOs respective firm's between the years 2010 – 2020. The executive compensation dataset includes the firm's ticker symbol, a unique Executive/Company ID, and all the options awarded for all CEOs of a given company for each year, among others. It is important to mention that each CEO may have received multiple option awards in a given year which each represent a unique observation in the dataset. An example extract is shown below:
Code:
* Example generated by -dataex-. For more info, type help dataex clear input str58 FullName str5 Ticker long ExecutiveCompanyCombination int FiscalYear "Aldo Charles Zucaro" "ORI" 10945 2010 "James M. Loree" "SWK" 18636 2010 "James Joseph Murren" "MGM" 23752 2010 "Ralph Izzo, Ph.D." "PEG" 29526 2012 "William J. Walljasper" "CASY" 29638 2011 "Richard A. Gottscho" "LRCX" 35287 2017 "Matthew Glenn Manders" "CI" 45083 2014 "John N. Roberts, III" "JBHT" 45173 2013 "Michael Patrick Lyons" "PNC" 46737 2014 "Anne L. Bramman" "JWN" 58822 2018 end
Code:
* Example generated by -dataex-. For more info, type help dataex clear input str50 Name int Year double CashFlow "Old Republic International Corporation" 2016 496.5 "Stanley Black & Decker, Inc." 2020 4365.1 "MGM Resorts International" 2010 13750.376 "Public Service Enterprise Group Inc" 2011 20391 "Casey's General Stores, Inc." 2015 2649.394 "Lam Research Corporation" 2016 1844.685 "Cigna Corporation" 2017 3915 "J.B. Hunt Transport Services, Inc." 2016 3612.391 "PNC Financial Services Group, Inc." 2012 9405 "Nordstrom, Inc." 2012 3743 end
I want to combine the two datasets such that every option observation for a given CEO is in line with the relevant financial information for their firm in the given year.
My initial attempts involved using m:m merge (ghastly, I know) which, surprisingly, yielded results very close to what I wanted. However, when the number of matching observations between the two datasets is not equal, m:m merge replaces all additional observations with the subsequent last observation, ruining the year to year matching.
Counter to this, I would like that each option after the first instance within a specific year simply repeats the respective financial information. For a little more clarification, below is an extract of one CEO’s option awards for 2010 whereby each observation should be accompanied by the financial information for ‘HES’ in the year 2010:
Code:
* Example generated by -dataex-. For more info, type help dataex clear input str58 FullName str5 Ticker long ExecutiveCompanyCombination int FiscalYear double(OptionExercisePrice OptionMoneynessMIN) "John B. Hess" "HES" 79 2010 . . "John B. Hess" "HES" 79 2010 81.85 0 "John B. Hess" "HES" 79 2010 56.43 .35637072479177756 "John B. Hess" "HES" 79 2010 60.07 .2741801231896122
I appreciate this is a rather longwinded question and I may have fallen short in explaining it clearly so please do not hesitate to ask for further explanations.
Thank you!
0 Response to Merging Datasets With Unequal Observations
Post a Comment