Dear users,
I am trying to 1:1 merge two panel data sets on the variables id and year.
When looking at the data I see several points which are uniquely identified by id and year. However, they do not merge. Below I have posted examples from my dataset. The dataset above is the using file and the data set below is the master file after merging. As shown, both are identified by the same values for id and year, however, Stata indicated master file only after merging.
Does someone know the issue? Thank you in advance.
I am trying to 1:1 merge two panel data sets on the variables id and year.
When looking at the data I see several points which are uniquely identified by id and year. However, they do not merge. Below I have posted examples from my dataset. The dataset above is the using file and the data set below is the master file after merging. As shown, both are identified by the same values for id and year, however, Stata indicated master file only after merging.
Does someone know the issue? Thank you in advance.
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input float year long id float panelid long change float(lag_IO lag_IO_USD lag_IO_PROP lag_HHI) 2002 87 59506 -2516 .6018923 5709159424 .0011180569 .04789028 2003 87 59670 -71680 .6130163 4918107136 .001185605 .04927485 2004 87 58456 160155 .6398947 6301260800 .0011565884 .04430657 2005 87 59739 -474 .5909891 8636153856 .001347798 .026627507 2006 87 59956 -211954 .59058523 9510181888 .0012887628 .04242186 2007 87 59829 -233665 .5738135 12048774144 .0013304997 .04610071 end label values id id2 label def id2 87 "ADM", modify
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input float year long id float(esg panelid) long change float(lag_IO lag_IO_USD lag_IO_PROP lag_HHI) byte _merge 2010 2 78.91 2861 -739 .6656588 10451429376 .0014352862 .027291656 3 2011 2 87.57 4106 1285 .6152239 9676599296 .0012215164 .03233925 3 2012 2 86.87 3073 126 .5457439 5022808064 .0007129693 .035534024 3 2013 2 78.31 3853 -3206283 .5536094 5127286272 .000667337 .0428944 3 2004 3 31.8 . . . . . . 1 2005 3 26.87 4611 14435 .1929813 152088576 .00004504978 .08928618 3 2006 3 58.5 4618 10395 .3637863 302313728 .000064802254 .04092287 3 2007 3 66.54 4812 -330112 .4739601 279020288 .00005940335 .12103135 3 2008 3 61.96 4741 -19284 .52113575 168175728 .000033705313 .071338974 3 end label values id id2 label def id2 2 "ABS", modify label def id2 3 "ADM", modify label values _merge _merge label def _merge 1 "master only (1)", modify label def _merge 3 "matched (3)", modify
Comment