Hey everybody, I am having trouble with merging two of my data sets for the past 2 days. I have tried 1:1 1:m and m:1 style but Stata displays an error which my GVKEY and cusip codes are not unique identifiers even after making sure the cusips in both data sets matched. Therefore it may be the fact that a cusip or GVKEY variable is used several times to describe the data or the fact that one of my data information is given annually whilst the other is given quarterly. Given below is my first file to do with CEO characteristics between 2006-2016:


Code:
* Example generated by -dataex-. To install: ssc install dataex
clear
input str6 gvkey str8 cusip double year float(CPS_w tenure) double age
"001004" "00036110" 2006 .48900285         . 50
"001004" "00036110" 2006 .48900285         .  .
"001004" "00036110" 2006 .48900285         .  .
"001004" "00036110" 2006 .48900285 21.654795 54
"001004" "00036110" 2006 .48900285         .  .
"001004" "00036110" 2007  .3878649         . 43
"001004" "00036110" 2007  .3878649 21.654795 55
"001004" "00036110" 2007  .3878649         . 48
"001004" "00036110" 2007  .3878649         . 51
"001004" "00036110" 2007  .3878649         . 65
"001004" "00036110" 2008   .414753         . 52
"001004" "00036110" 2008   .414753         . 49
"001004" "00036110" 2008   .414753         . 44
"001004" "00036110" 2008   .414753         . 67
"001004" "00036110" 2008   .414753 21.654795 56
"001004" "00036110" 2009  .4549136         . 53
"001004" "00036110" 2009  .4549136         . 68
"001004" "00036110" 2009  .4549136         . 45
"001004" "00036110" 2009  .4549136         . 50
"001004" "00036110" 2009  .4549136 21.654795 57
"001004" "00036110" 2010  .4264813         . 53
"001004" "00036110" 2010  .4264813         . 69
"001004" "00036110" 2010  .4264813         . 54
"001004" "00036110" 2010  .4264813 21.654795 58
"001004" "00036110" 2010  .4264813         . 46
"001004" "00036110" 2011  .4426216         . 55
"001004" "00036110" 2011  .4426216 21.654795 59
"001004" "00036110" 2011  .4426216         . 54
"001004" "00036110" 2011  .4426216         . 47
"001004" "00036110" 2011  .4426216         . 70
"001004" "00036110" 2012  .4386075 21.654795 60
"001004" "00036110" 2012  .4386075         . 56
"001004" "00036110" 2012  .4386075         . 58
"001004" "00036110" 2012  .4386075         . 51
"001004" "00036110" 2012  .4386075         . 55
"001004" "00036110" 2013 .43138945         . 57
"001004" "00036110" 2013 .43138945 21.654795 61
"001004" "00036110" 2013 .43138945         . 59
"001004" "00036110" 2013 .43138945         . 56
"001004" "00036110" 2013 .43138945         . 47
"001004" "00036110" 2014   .380103         . 57
"001004" "00036110" 2014   .380103 21.654795 62
"001004" "00036110" 2014   .380103         . 38
"001004" "00036110" 2014   .380103         . 48
"001004" "00036110" 2014   .380103         . 58
"001004" "00036110" 2015  .4071265         . 54
"001004" "00036110" 2015  .4071265         . 39
"001004" "00036110" 2015  .4071265         . 58
"001004" "00036110" 2015  .4071265 21.654795 63
"001004" "00036110" 2015  .4071265         . 59
"001004" "00036110" 2016  .3880624 21.654795 64
"001004" "00036110" 2016  .3880624         . 40
"001004" "00036110" 2016  .3880624         . 60
"001004" "00036110" 2016  .3880624         . 59
"001004" "00036110" 2016  .3880624         . 44
"001013" "00088630" 2006  .5206139         . 60
"001013" "00088630" 2006  .5206139         .  .
"001013" "00088630" 2006  .5206139         .  .
"001013" "00088630" 2006  .5206139         .  .
"001013" "00088630" 2006  .5206139         .  .
"001013" "00088630" 2007  .5610326         . 50
"001013" "00088630" 2007  .5610326         . 55
"001013" "00088630" 2007  .5610326         . 61
"001013" "00088630" 2007  .5610326         . 47
"001013" "00088630" 2007  .5610326         . 43
"001013" "00088630" 2008   .498024         . 48
"001013" "00088630" 2008   .498024         . 44
"001013" "00088630" 2008   .498024         . 56
"001013" "00088630" 2008   .498024         . 62
"001013" "00088630" 2008   .498024         . 51
"001013" "00088630" 2009  .5275596         . 57
"001013" "00088630" 2009  .5275596         . 63
"001013" "00088630" 2009  .5275596         . 49
"001013" "00088630" 2009  .5275596         . 52
"001013" "00088630" 2009  .5275596         . 45
"001013" "00088630" 2010  .4832326         . 50
"001013" "00088630" 2010  .4832326         . 48
"001013" "00088630" 2010  .4832326         . 58
"001013" "00088630" 2010  .4832326         . 46
"001013" "00088630" 2010  .4832326         . 64
"001034" "02081310" 2006 .25010556         .  .
"001034" "02081310" 2006 .25010556         .  .
"001034" "02081310" 2006 .25010556         .  .
"001034" "02081310" 2006 .25010556         .  .
"001034" "02081310" 2006 .25010556         .  .
"001034" "02081310" 2007 .36035085         . 51
"001034" "02081310" 2007 .36035085         . 46
"001034" "02081310" 2007 .36035085         . 44
"001034" "02081310" 2007 .36035085         . 53
"001034" "02081310" 2007 .36035085         . 62
"001045" "02376R10" 2006  .4392289         .  .
"001045" "02376R10" 2006  .4392289       8.6 48
"001045" "02376R10" 2006  .4392289         .  .
"001045" "02376R10" 2006  .4392289         .  .
"001045" "02376R10" 2006  .4392289 2.0328767  .
"001045" "02376R10" 2007  .4017118         . 49
"001045" "02376R10" 2007  .4017118         . 57
"001045" "02376R10" 2007  .4017118       8.6 48
"001045" "02376R10" 2007  .4017118 2.0328767 45
"001045" "02376R10" 2007  .4017118         . 52
end


Whilst my second data describes firm characteristics such as the value of EBITDA between 2006-2016: 
* Example generated by -dataex-. To install: ssc install dataex
clear
input long datadate double year str6 gvkey str8 cusip double(at ebitda)
20970 2016 "001004" "00036110"    1504.1    148.2
17317 2006 "001004" "00036110"  1067.633  118.907
20605 2015 "001004" "00036110"    1442.1    136.9
19509 2012 "001004" "00036110"    2136.9    245.2
18048 2008 "001004" "00036110"  1377.511   166.08
17683 2007 "001004" "00036110"   1362.01  168.522
18413 2009 "001004" "00036110"  1501.042  134.345
18778 2010 "001004" "00036110"  1703.727  196.312
19874 2013 "001004" "00036110"    2199.5      256
19144 2011 "001004" "00036110"  2195.653  222.693
20239 2014 "001004" "00036110"      1515     83.7
17470 2007 "001013" "00088630"    1764.8    167.9
18535 2010 "001013" "00088630"    1474.5    121.4
17836 2008 "001013" "00088630"      1921    173.3
18170 2009 "001013" "00088630"    1343.6     84.7
17105 2006 "001013" "00088630"    1611.4    140.4
16982 2006 "001021" "00105820"    14.341    1.252
17713 2008 "001021" "00105820"    21.401   -2.721
17347 2007 "001021" "00105820"    27.171    -.432
17166 2006 "001034" "02081310"   927.239  138.914
17531 2007 "001034" "02081310"  1288.165   40.816
18262 2009 "001045" "02376R10"     25438      262
17166 2006 "001045" "02376R10"     29145     2217
17897 2008 "001045" "02376R10"     25175      510
17531 2007 "001045" "02376R10"     28571     2093
20819 2016 "001045" "02376R10"     51274     7833
20088 2014 "001045" "02376R10"     43771     6585
19358 2012 "001045" "02376R10"     23510     1434
18627 2010 "001045" "02376R10"     25088     1303
20453 2015 "001045" "02376R10"     48415     8891
18992 2011 "001045" "02376R10"     23848      695
19723 2013 "001045" "02376R10"     42278     2956
17166 2006 "001048" "00181400"      2749      271
18262 2009 "001050" "12514110"    77.515    3.799
20453 2015 "001050" "12514110"   598.819   45.171
19723 2013 "001050" "12514110"   348.536   25.643
18627 2010 "001050" "12514110"    74.791    6.398
20819 2016 "001050" "12514110"   498.634   56.219
19358 2012 "001050" "12514110"    94.104   17.933
17166 2006 "001050" "12514110"    63.188    7.276
20088 2014 "001050" "12514110"   414.365     35.6
18992 2011 "001050" "12514110"    79.345   13.767
17897 2008 "001050" "12514110"   120.017   11.371
17531 2007 "001050" "12514110"    96.535   14.214
16982 2006 "001056" "00776810"   638.022   77.942
18596 2010 "001062" "G3156P10"    671.58        .
20057 2014 "001062" "G3156P10"   223.333   -1.458
19327 2012 "001062" "G3156P10"   468.013        .
17500 2007 "001062" "G3156P10"   815.468   10.636
19327 2012 "001062" "G3156P10"   468.013    1.722
20422 2015 "001062" "G3156P10"    162.35    -1.71
17135 2006 "001062" "G3156P10"   720.523    7.869
18231 2009 "001062" "G3156P10"   581.896        .
17135 2006 "001062" "G3156P10"   720.523        .
20057 2014 "001062" "G3156P10"   223.333        .
18961 2011 "001062" "G3156P10"   632.715    2.039
19692 2013 "001062" "G3156P10"   252.142        .
20788 2016 "001062" "G3156P10"    245.02       -2
17866 2008 "001062" "G3156P10"   355.664    5.524
17866 2008 "001062" "G3156P10"   355.664        .
17500 2007 "001062" "G3156P10"   815.468        .
19692 2013 "001062" "G3156P10"   252.142     .371
18596 2010 "001062" "G3156P10"    671.58     .423
18231 2009 "001062" "G3156P10"   581.896    -.307
18961 2011 "001062" "G3156P10"   632.715        .
20788 2016 "001062" "G3156P10"    245.02        .
20422 2015 "001062" "G3156P10"    162.35        .
18717 2010 "001072" "00244410"  2319.482  381.118
19083 2011 "001072" "00244410"  2468.012  322.441
19813 2013 "001072" "00244410"  2384.988  209.373
20909 2016 "001072" "00244410"  2477.413  244.734
17256 2006 "001072" "00244410"  1899.536  236.072
18352 2009 "001072" "00244410"  2051.492  227.244
19448 2012 "001072" "00244410"  2601.995  193.276
20544 2015 "001072" "00244410"  2409.819  208.253
20178 2014 "001072" "00244410"  2459.015  254.963
17987 2008 "001072" "00244410"  1872.529  175.718
17622 2007 "001072" "00244410"  2109.078  219.482
19723 2013 "001075" "72348410" 13508.686 1262.031
18992 2011 "001075" "72348410" 13111.018 1173.562
19358 2012 "001075" "72348410" 13379.615 1256.091
20819 2016 "001075" "72348410" 16004.253 1341.813
18262 2009 "001075" "72348410" 11808.155  984.557
17531 2007 "001075" "72348410" 11243.712  992.687
20453 2015 "001075" "72348410" 15028.258 1349.024
17166 2006 "001075" "72348410" 11455.943  977.514
18627 2010 "001075" "72348410" 12362.703 1138.439
17897 2008 "001075" "72348410" 11620.093  920.904
20088 2014 "001075" "72348410" 14313.532   1228.6
17166 2006 "001076" "00253530"   979.606   522.82
17531 2007 "001076" "00253530"  1113.176   577.32
19723 2013 "001076" "00253530"  1827.176  907.064
20819 2016 "001076" "00253530"  2615.736 1646.804
17897 2008 "001076" "00253530"   1233.27  618.791
19358 2012 "001076" "00253530"  1812.929  916.033
20088 2014 "001076" "00253530"  2456.844 1194.234
18627 2010 "001076" "00253530"  1502.072  743.366
18262 2009 "001076" "00253530"  1321.456  705.274
18992 2011 "001076" "00253530"  1735.149  826.362
20453 2015 "001076" "00253530"  2658.875 1536.964
end
format %d datadate
Whilst trying to merge the typical message from Stata would be: merge m:1 gvkey cusip using "CPS.dta" variables gvkey cusip do not uniquely identify observations in the using data.
Hopefully I can recieve some help as I have been struggling with this problem over the past 48 hour .
Thanks in advance,

Alli (Mr)