I have a quick (maby redundant) question about joinby. I have many different panel datasets that I would like to combine. My main dataset has monthly data on, e.g., salary, while I also have yearly data on gender, educational level, etc. I want to keep the monthly variation, so I do not want to collapse the data and average the salary yearly. I also assume that gender and educational level does not vary throughout the year. The joinby-command seems to do the trick, but I just want to consult the forum to see I am missing something (e.g. would it behave differently if I have much more data) or whether there is a better tool?
Here are two (very simple) example datasets:
Code:
clear input float(id year gender) 1 2010 1 end
Code:
clear input float(id year salary month ym) 1 2010 1 1 600 1 2010 1 2 601 1 2010 2 3 602 1 2010 1 4 603 1 2010 2 5 604 1 2010 1 6 605 1 2010 2 7 606 1 2010 1 8 607 1 2010 3 9 608 1 2010 4 10 609 1 2010 5 11 610 1 2010 1 12 611 end format %tm ym
Code:
joinby id year using "filename.dta"
Gustav
0 Response to Using joinby to combine monthly and yearly panel datasets
Post a Comment