Announcement

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

  • #31
    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
    Code:
    use dataset1, clear
    merge 1:m GVKEY YEAR using dataset2
    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.

    Comment


    • #32
      Originally posted by Clyde Schechter View Post
      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
      Code:
      use dataset1, clear
      merge 1:m GVKEY YEAR using dataset2
      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.
      got every GVKEY-YEAR of first dataset, containing one observation per GVKEY YEAR, linked with the second dataset. The merged dataset looks good now.

      Comment

      Working...
      X