Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Variables do not uniquely identify observations, but no duplicates

    Hello All,

    I know this topic has been brought up time and again. However, I went through some of the old threads, and I don't think they fit my case. I have a dataset that uses directed-dyad year, meaning that the same set of countries get counted twice per year (e.g. USA-CAN 2000...CAN-USA 2000). Small snippet below.

    Code:
    input int(ccode1 ccode2 year) byte conttype
     2  20 2000 1
     2  20 2001 1
     2  20 2002 1
     2  20 2003 1
     2  20 2004 1
     2  20 2005 1
     2  20 2006 1
     2  20 2007 1
     2  20 2008 1
     2  20 2009 1
     2  20 2010 1
     2  20 2011 1
     2  20 2012 1
     2  20 2013 1
     2  20 2014 1
     2  20 2015 1
     2  20 2016 1
     2  31 2000 4
     2  31 2001 4
     2  31 2002 4
     2  31 2003 4
     2  31 2004 4
     2  31 2005 4
     2  31 2006 4
     2  31 2007 4
     2  31 2008 4
     2  31 2009 4
     2  31 2010 4
     2  31 2011 4
     2  31 2012 4
     2  31 2013 4
     2  31 2014 4
     2  31 2015 4
     2  31 2016 4
     2  40 2000 4
     2  40 2001 4
     2  40 2002 4
     2  40 2003 4
     2  40 2004 4
     2  40 2005 4
     2  40 2006 4
     2  40 2007 4
     2  40 2008 4
     2  40 2009 4
     2  40 2010 4
     2  40 2011 4
     2  40 2012 4
     2  40 2013 4
     2  40 2014 4
     2  40 2015 4
     2  40 2016 4
     2  70 2000 1
     2  70 2001 1
     2  70 2002 1
     2  70 2003 1
     2  70 2004 1
     2  70 2005 1
     2  70 2006 1
     2  70 2007 1
     2  70 2008 1
     2  70 2009 1
     2  70 2010 1
     2  70 2011 1
     2  70 2012 1
     2  70 2013 1
     2  70 2014 1
     2  70 2015 1
     2  70 2016 1
    However, when I tried to check the variables,
    Code:
    isid ccode1 ccode2 year
    I get,
    variables ccode1 ccode2 year do not uniquely identify the observations
    Code:
    . duplicates report
    
    Duplicates in terms of all variables
    
    --------------------------------------
       copies | observations       surplus
    ----------+---------------------------
            1 |        18690             0
    --------------------------------------
    
    .
    Code:
     duplicates list
    
    Duplicates in terms of all variables
    
    (0 observations are duplicates)

    The interesting thing is that I had an older version of this dataset, and I didn't run into this problem before. I've been sitting on this for a couple of days, and haven't really figured out what may be the problem after going through the data. Any leads would be helpful. Thank you in advance.

  • #2
    It seems to me that your duplicates commands are not really comparable to your isid command, because they compare all the variables in the dataset. I expect that the observations with duplicate values of ccode1, ccode2, and year have different values of conttype. Try adding the three variables to the duplicates commands.

    Comment


    • #3
      Originally posted by William Lisowski View Post
      It seems to me that your duplicates commands are not really comparable to your isid command, because they compare all the variables in the dataset. I expect that the observations with duplicate values of ccode1, ccode2, and year have different values of conttype. Try adding the three variables to the duplicates commands.
      Hello, William. Thank you for your reply. I think I may have come across this on another thread, but I didn't understand it for some reason. I found
      Code:
      duplicates report ccode1 ccode2 year
      
      Duplicates in terms of ccode1 ccode2 year
      
      --------------------------------------
         copies | observations       surplus
      ----------+---------------------------
              1 |        18686             0
              2 |            4             2
      --------------------------------------
      
      . duplicates list ccode1 ccode2 year
      
      Duplicates in terms of ccode1 ccode2 year
      
        +----------------------------------------+
        | group:   obs:   ccode1   ccode2   year |
        |----------------------------------------|
        |      1   8506      380      390   2000 |
        |      1   8507      380      390   2000 |
        |      2   8813      390      380   2000 |
        |      2   8814      390      380   2000 |
      Thank you!

      Comment

      Working...
      X