Hi all,
I'm using Stata 13
I have two panel datasets which I want to combine before performing panel data analysis. I want to merge them with cont as the key variable in both datasets. After searching in this forum and reading Stata documentation, I found that merging m:m is not recommended. However, in either of my data files, the key variable i.e cont does not uniquely identify observations. I would like to know how I can combine these files properly. Here are my codes.

Thank you in advance.




Code:
* Example generated by -dataex-. To install: ssc install dataex
clear
input long cont int year double con
1 1996  -.479990571737289
1 1998  -.969703316688538
1 2000    -.9487224817276
1 2002  -.936570703983307
1 2003  -.668102145195007
1 2004  -.625496447086334
1 2005  -.420722633600235
1 2006  -.479711323976517
1 2007  -.510263919830322
1 2008  -.561398804187775
1 2009  -.546603560447693
1 2010  -.487753301858902
1 2011  -.495235502719879
1 2012  -.473732590675354
1 2013  -.471443355083466
1 2014  -.615056157112122
1 2015  -.681528627872467
2 1996   -1.1580982208252
2 1998  -1.31885612010956
2 2000  -1.51669120788574
2 2002  -1.13693428039551
2 2003  -1.30378973484039
2 2004  -1.28112351894379
2 2005  -1.32844984531403
2 2006  -1.18326342105865
2 2007  -1.29391300678253
2 2008  -1.28144896030426
2 2009  -1.41839635372162
2 2010  -1.31937599182129
2 2011  -1.33731091022491
2 2012  -1.29281687736511
2 2013   -1.3274017572403
2 2014  -1.45260882377625
2 2015  -1.39689266681671
3 1996  -.930731236934662
3 1998  -.599704921245575
3 2000  -.492773354053497
3 2002  -.792010486125946
3 2003  -.568924784660339
3 2004  -.493647992610931
3 2005  -.967230558395386
3 2006  -.634681701660156
3 2007  -.485509812831879
3 2008  -.529309689998627
3 2009  -.672597169876099
3 2010  -.736073732376099
3 2011  -.641205787658691
3 2012  -.932276546955109
3 2013  -.835047841072083
3 2014  -.779850125312805
3 2015  -.614093601703644
4 1996   .585982918739319
4 1998   .705786645412445
4 2000   .666208446025848
4 2002   .606006324291229
4 2003   1.24966859817505
4 2004   .879439413547516
4 2005   1.13936281204224
4 2006    .91353040933609
4 2007   .953749895095825
4 2008   .996397376060486
4 2009   .921875059604645
4 2010    1.0030460357666
4 2011   .978980958461761
4 2012   .916711270809174
4 2013   .905239403247833
4 2014   .801953852176666
4 2015   .836243391036987
5 1996   .221323579549789
5 1998  -.243101984262466
5 2000  -.140609890222549
5 2002 -.0216778069734573
5 2003 -.0334532484412193
5 2004  -.152626678347588
5 2005 -.0901671200990677
5 2006  -.321892380714417
5 2007   -.34767347574234
5 2008  -.322432726621628
5 2009    -.3802669942379
5 2010  -.389968305826187
5 2011  -.392363369464874
5 2012  -.512988686561584
5 2013  -.568455696105957
5 2014  -.525218844413757
5 2015  -.337194502353668
6 1996  -1.38878548145294
6 1998  -1.15435969829559
6 2000  -1.01455616950989
6 2002  -.942693650722504
6 2003  -1.04709053039551
6 2004  -.969922661781311
6 2005  -.896313488483429
6 2006  -1.04971444606781
6 2007  -1.11327052116394
6 2008  -1.01774668693542
6 2009  -1.06808841228485
6 2010  -1.10275399684906
6 2011  -1.12114119529724
6 2012  -1.44282460212708
6 2013  -1.37953495979309
end
label values cont cont
label def cont 1 "Algeria", modify
label def cont 2 "Angola", modify
label def cont 3 "Benin", modify
label def cont 4 "Botswana", modify
label def cont 5 "Burkina Faso", modify
label def cont 6 "Burundi", modify
save corruption, replace

use gdp, clear
Code:
* Example generated by -dataex-. To install: ssc install dataex
clear
input long cont int year double gdp
 1 1996 1600.34314084675
 1 1997 1616.12786090325
 1 1998 1592.40220267178
 1 1999 1584.76923687038
 1 2011 5462.14770069077
 1 2012  5591.0741736079
 1 2013 5499.58761944181
 1 2014 5493.05493011175
 1 2015 4177.88108308386
 2 1996 605.926262602813
 2 1997 687.673907751885
 2 1998 561.068467466783
 2 1999 518.513771739681
 2 2011 4615.47048481311
 2 2012 5100.09818959712
 2 2013 5254.88325325799
 2 2014 5408.40956818969
 2 2015 4166.97962608836
 3 1996 418.704018029812
 3 1997 390.245956110796
 3 1998  410.06849334217
 3 1999 403.622464281663
 3 2011 1128.79375742067
 3 2012 1145.20618918285
 3 2013  1250.8545018098
 3 2014 1289.69172959742
 3 2015 1076.36476176784
 4 1996 3221.67944007649
 4 1997 3259.01304399046
 4 1998 3039.98511837412
 4 1999 3405.81609623988
 4 2011  7617.2886759422
 4 2012 7877.73254195134
 4 2013 7224.90035132411
 4 2014 7780.64781170266
 4 2015 6799.86897679685
 5 1996  251.91996573776
 5 1997 231.848841560379
 5 1998 258.343166672719
 5 1999 267.014677425016
 5 2011 666.839885175754
 5 2012 673.821097617315
 5 2013 699.778942710914
 5 2014 703.819602413769
 5 2015 575.314446879624
 6 1996 143.390252646053
 6 1997 158.907803954623
 6 1998 144.480777493698
 6 1999 128.950685993145
 6 2011  249.57797276983
 6 2012 252.358975484722
 6 2013 256.975943416749
 6 2014   274.8645313666
 6 2015 276.628191527054
 7 1996 739.229443982996
 7 1997 687.987220206509
 7 1998  722.05125821984
 7 1999 717.383507585447
 7 2011  1403.2555961828
 7 2012 1354.62305483867
 7 2013 1465.22248131789
 7 2014 1540.56873612806
 7 2015  1326.9692603504
 8 1996 1451.62319403764
 8 1997 1387.88460656488
 8 1998 1449.24742279396
 8 1999 1614.35546537259
 8 2011 3740.38678819961
 8 2012 3447.52587156774
 8 2013 3615.97904142331
 8 2014 3588.66020517565
 8 2015 3043.01418113393
 9 1996 318.732469352037
 9 1997 289.216686062106
 9 1998 291.215171887293
 9 1999 293.911932310757
 9 2011 551.027916481139
 9 2012 565.832891054084
 9 2013 382.339644232389
 9 2014 426.684602815753
 9 2015  380.40428862584
10 1996 253.383718941533
10 1997 233.866518128174
10 1998 257.312998291093
10 1999 215.917495977961
10 2011 1049.76530150311
10 2012 1095.35490782394
10 2013 1044.40100971805
10 2014 1061.21388713519
10 2015 831.782755629006
11 1996  982.94913431693
11 1997 880.390208590891
11 1998  870.86405822666
11 1999 876.999564112555
11 2011  1446.0681593698
11 2012 1403.42834848539
11 2013 1504.92167160989
11 2014 1511.82179116207
11 2015 1271.05781349774
12 1996 214.125345317668
end
label values cont cont
label def cont 1 "Algeria", modify
label def cont 2 "Angola", modify
label def cont 3 "Benin", modify
label def cont 4 "Botswana", modify
label def cont 5 "Burkina Faso", modify
label def cont 6 "Burundi", modify
label def cont 7 "Cameroon", modify
label def cont 8 "Cape Verde", modify
label def cont 9 "Central African Republic", modify
label def cont 10 "Chad", modify
label def cont 11 "Comoros", modify
label def cont 12 "Congo, Dem. Rep.", modify
merge m:m cont using corruption