So it seems that you actually want to have a separate observation for each CEO after the merge, and there can be more than 1 CEO per firm per year. So
will do the trick so long as GVKEY and YEAR do uniquely identify observations in the first data set. If you have multiple observations of some GVKEY-YEAR pairs in dataset 1 as well, then it's a different story and you need to explain which of the multiple observations of a given GVKEY-YEAR pair in the first data set should be paired with which of the multiple observations of that same GVKEY-YEAR pair in the second one.
Code:
use dataset1, clear merge 1:m GVKEY YEAR using dataset2
Comment