Hello everybody,
I am currently trying to merge two datasets. One Dataset (Platforms) contains the annual traffic of a company and the other (test1) contains the executives. In the Platforms dataset I have different years and companies and for each year and company one number of traffic. In the test1 database, I have multiple executives for each year and each company. I want to use the Platforms database as my base and merge the test1 on it so that I get for one year multiple executives but the same number of traffic in each row for that year. I need to do it this way because I am going to merge for each year one different dataset with the executives.
My idea for the code was the following:
The variable name for year is "year" and for company is "dp"
Here you can find an example of one company and one year for each of the two datasets.
Platforms:
test1
If I use my code I get for the year 2020 just one executive in the merged data and not all the executives.
Can anyone help me with the code?
Thanks in advance and best regards Jana
I am currently trying to merge two datasets. One Dataset (Platforms) contains the annual traffic of a company and the other (test1) contains the executives. In the Platforms dataset I have different years and companies and for each year and company one number of traffic. In the test1 database, I have multiple executives for each year and each company. I want to use the Platforms database as my base and merge the test1 on it so that I get for one year multiple executives but the same number of traffic in each row for that year. I need to do it this way because I am going to merge for each year one different dataset with the executives.
My idea for the code was the following:
The variable name for year is "year" and for company is "dp"
Code:
use "Platform" merge 1:m dp year using "test1.dta"
Platforms:
Code:
year dp totalplatact 2013 airbnb 5 2014 airbnb 66 2015 airbnb 54 2016 airbnb 34 2017 airbnb 21 2018 airbnb 46 2019 airbnb 12 2020 airbnb 8
Code:
person_name dp year Erin Coffman airbnb 2020 Harrison Shoff airbnb 2020 Brian Chesky airbnb 2020 Scott Raymond airbnb 2020 Damir Duskan airbnb 2020 Justin K Chen airbnb 2020 MatÃ*as Vives airbnb 2020 Jackson Wang airbnb 2020 David Leach airbnb 2020 Chip Conley airbnb 2020 Justin K Chen airbnb 2020 Peter Coles airbnb 2020 Josh Horowitz airbnb 2020 Christopher Lukezic airbnb 2020 Peter Coles airbnb 2020 Justin K Chen airbnb 2020 Joe Gebbia airbnb 2020 Dzmitry Bazhko airbnb 2020
Can anyone help me with the code?
Thanks in advance and best regards Jana

Comment