I have 2 datasets, which I want to merge according to the variables codistat_municip and year
the first one is :
the second one is:
I want to perform a merge 1:1 through the code
merge 1:1 codistat_municip year etc...
However, STATA returns the error "variables codistat_municip year do not uniquely identify observations in the
using data"
What should I do?
the first one is :
Code:
* Example generated by -dataex-. For more info, type help dataex clear input long codistat_municip int year double pop_born_tot_f 1001 1991 3 1001 1992 10 1001 1993 9 1001 1994 7 1001 1995 11 1001 1996 7 1001 1997 8 1001 1998 9 1001 1999 7 1001 2000 9 1001 2001 6 1002 1991 1 1002 1992 23 1002 1993 12 1002 1994 15 1002 1995 21 1002 1996 10 1002 1997 23 1002 1998 15 1002 1999 11 1002 2000 25 1002 2001 14 1003 1991 0 1003 1992 1 1003 1993 3 1003 1994 1 1003 1995 1 1003 1996 4 1003 1997 2 1003 1998 2 1003 1999 6 1003 2000 2 1003 2001 1 1004 1991 1 1004 1992 7 1004 1993 4 1004 1994 4 1004 1995 7 1004 1996 8 1004 1997 8 1004 1998 4 1004 1999 7 1004 2000 5 1004 2001 4 1005 1991 1 1005 1992 1 1005 1993 2 1005 1994 2 1005 1995 3 1005 1996 4 1005 1997 2 1005 1998 1 1005 1999 1 1005 2000 2 1005 2001 2 1006 1991 3 1006 1992 17 1006 1993 18 1006 1994 15 1006 1995 24 1006 1996 16 1006 1997 24 1006 1998 17 1006 1999 30 1006 2000 9 1006 2001 23 1007 1991 0 1007 1992 1 1007 1993 2 1007 1994 2 1007 1995 2 1007 1996 0 1007 1997 0 1007 1998 3 1007 1999 0 1007 2000 0 1007 2001 0 1008 1991 7 1008 1992 73 1008 1993 92 1008 1994 72 1008 1995 82 1008 1996 75 1008 1997 69 1008 1998 60 1008 1999 62 1008 2000 56 1008 2001 52 1009 1991 1 1009 1992 6 1009 1993 7 1009 1994 5 1009 1995 10 1009 1996 7 1009 1997 10 1009 1998 6 1009 1999 8 1009 2000 13 1009 2001 2 1010 1991 0 end
Code:
* Example generated by -dataex-. For more info, type help dataex clear input long codistat_municip float year double pop_tot_0_f 1001 1982 5 1001 1983 8 1001 1984 10 1001 1985 4 1001 1986 6 1001 1987 14 1001 1988 6 1001 1989 14 1001 1990 10 1001 1991 11 1001 1992 7 1001 1993 9 1001 1994 11 1001 1995 8 1001 1996 12 1001 1997 8 1001 1998 6 1001 1999 10 1001 2000 7 1001 2001 7 1001 2002 8 1001 2003 10 1001 2004 13 1001 2005 6 1001 2006 5 1001 2007 7 1001 2008 10 1001 2009 16 1001 2010 9 1001 2011 10 1001 2012 11 1001 2013 10 1001 2014 15 1001 2015 9 1001 2016 11 1001 2017 9 1001 2018 7 1001 2019 15 1001 2020 11 1001 2021 7 1001 2022 7 1002 1982 25 1002 1983 27 1002 1984 26 1002 1985 20 1002 1986 27 1002 1987 24 1002 1988 15 1002 1989 23 1002 1990 18 1002 1991 22 1002 1992 19 1002 1993 20 1002 1994 14 1002 1995 14 1002 1996 23 1002 1997 12 1002 1998 22 1002 1999 14 1002 2000 10 1002 2001 23 1002 2002 19 1002 2003 21 1002 2004 14 1002 2005 21 1002 2006 19 1002 2007 13 1002 2008 23 1002 2009 20 1002 2010 22 1002 2011 23 1002 2012 22 1002 2013 10 1002 2014 11 1002 2015 21 1002 2016 15 1002 2017 18 1002 2018 12 1002 2019 7 1002 2020 11 1002 2021 9 1002 2022 6 1003 1982 2 1003 1983 0 1003 1984 0 1003 1985 1 1003 1986 3 1003 1987 0 1003 1988 1 1003 1989 0 1003 1990 3 1003 1991 2 1003 1992 2 1003 1993 2 1003 1994 3 1003 1995 1 1003 1996 0 1003 1997 4 1003 1998 2 1003 1999 1 end
merge 1:1 codistat_municip year etc...
However, STATA returns the error "variables codistat_municip year do not uniquely identify observations in the
using data"
What should I do?
Comment