Dear all,
I want to merge 2 datasets based on non-unique identifiers (this is why I use joinby Licensee using ...). Each row represents a unique licensing deal. There are 3 variables in Dataset1, namely Licensor, Licensee and LicensingYear and there are 2 variables in Dataset2, namely Licensee and PublicationYear. I would only like to merge when publicationYear is up to 5 years after the LicensingYear for a given Licensee.
Dataset1:
Dataset2:
This is the result that I want:
When I use joinby it does not take the 5-year period into account. And I have tried to combine joinby and rangestat, but that would give me an error.
Can somebody give me feedback please?
Thank you in advance.
I want to merge 2 datasets based on non-unique identifiers (this is why I use joinby Licensee using ...). Each row represents a unique licensing deal. There are 3 variables in Dataset1, namely Licensor, Licensee and LicensingYear and there are 2 variables in Dataset2, namely Licensee and PublicationYear. I would only like to merge when publicationYear is up to 5 years after the LicensingYear for a given Licensee.
Dataset1:
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input str1(Licensor Licensee) int LicensingYear "A" "G" 1999 "B" "I" 2002 end
Dataset2:
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input str1 Licensee int PublicationYear "G" 2003 "G" 1996 "G" 2000 "I" 2005 "I" 1994 end
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input str1(Licensor Licensee) int(LicensingYear PublicationYear) "A" "G" 1999 2003 "A" "G" 1999 2000 "B" "I" 2002 2005 end
Can somebody give me feedback please?
Thank you in advance.
Comment