Dear Statalist,
I want to combine three datasets. In dataset 1 (my main dataset) I have a panel with firm (ORDINAL) and time (year, from 1990 to 2013) and some other variables as for example sectors and regions. From another dataset 2, I have employment for each sector for the different regions from 1993 to 2007. And from dataset 3 I have employment for each sector for each region from 2008 to 2013. That is, dataset 1 is firms level while dataset 2 and 3 are regional data by sectors.
In order to merge those datasets I am using the following code, where CCAA1 is the id for regions, and newnaceclio is the id for sectors:
My problem is that I need to tell Stata that this is a panel with id(ORDINAL) year(year) but it give me this error
I don´t know what am I doing wrong. Can anyone give me a hand with this?
Thanks in advanced.
I want to combine three datasets. In dataset 1 (my main dataset) I have a panel with firm (ORDINAL) and time (year, from 1990 to 2013) and some other variables as for example sectors and regions. From another dataset 2, I have employment for each sector for the different regions from 1993 to 2007. And from dataset 3 I have employment for each sector for each region from 2008 to 2013. That is, dataset 1 is firms level while dataset 2 and 3 are regional data by sectors.
Code:
+------------------------------------+ | CCAA1 newnac~o year newwor~r | |------------------------------------| 1. | 1 1 2008 52505 | 2. | 1 1 2009 48966 | 3. | 1 1 2010 49414 | 4. | 1 1 2011 47264 | 5. | 1 1 2012 44904 | |------------------------------------| 6. | 1 1 2013 47170 | 7. | 1 2 2008 12158 | 8. | 1 2 2009 9815 | 9. | 1 2 2010 9426 | 10. | 1 2 2011 8830 | |------------------------------------| 11. | 1 2 2012 7919 | 12. | 1 2 2013 9086 | 13. | 1 3 2008 19733 | 14. | 1 3 2009 14942 | 15. | 1 3 2010 13753 |
Code:
+----------------------------------+ | CCAA1 newnac~o year worker | |----------------------------------| 1. | 1 1 1993 58271 | 2. | 1 1 1994 59180 | 3. | 1 1 1995 57143 | 4. | 1 1 1996 55592 | 5. | 1 1 1997 56492 | |----------------------------------| 6. | 1 1 1998 56227 | 7. | 1 1 1999 58156 | 8. | 1 1 2000 53856 | 9. | 1 1 2001 53819 | 10. | 1 1 2002 51748 | |----------------------------------| 11. | 1 1 2003 52904 | 12. | 1 1 2004 50106 | 13. | 1 1 2005 51564 | 14. | 1 1 2006 52516 | 15. | 1 1 2007 52501 | |----------------------------------| 16. | 1 2 1993 23416 | 17. | 1 2 1994 21481 | 18. | 1 2 1995 22371 | 19. | 1 2 1996 17999 | 20. | 1 2 1997 18396 | |----------------------------------| 21. | 1 2 1998 22040 | 22. | 1 2 1999 21689 | 23. | 1 2 2000 20450 | 24. | 1 2 2001 20818 |
Code:
merge m:1 CCAA1 newnaceclio year using "D:\Usuarios\dtojeiro\Dropbox\PhD\Second Paper ESEE_DATA\employ_by_ > region_sector_cenae93.dta" Result # of obs. ----------------------------------------- not matched 100,990 from master 100,683 (_merge==1) from using 307 (_merge==2) matched 26,613 (_merge==3) ----------------------------------------- . drop _merge . merge m:1 CCAA1 newnaceclio year using "D:\Usuarios\dtojeiro\Dropbox\PhD\Second Paper ESEE_DATA\employ_by_ > region_sector_cenae09.dta" Result # of obs. ----------------------------------------- not matched 116,321 from master 116,205 (_merge==1) from using 116 (_merge==2) matched 11,398 (_merge==3) -----------------------------------------
Code:
xtset ORDINAL year repeated time values within panel
Thanks in advanced.
Comment