Announcement

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

  • Error 1:1 merge

    Hello,

    I tried to merge (1:1) two datasets but I received the following message: "variables yr quarter country do not uniquely identify observations in the using data".

    Example of the using data:
    [CODE]
    * Example generated by -dataex-. To install: ssc install dataex
    clear
    input int date str18 country float(earthquake_mag date1 yr1) long country_ float(year_q date2 quarter yr)
    2005 "ALBANIA" 5.2 16437 2005 1 180 16437 1 2005
    2005 "ALBANIA" 5.2 16437 2005 1 181 16527 2 2005
    2005 "ALBANIA" 5.2 16437 2005 1 182 16618 3 2005
    2005 "ALBANIA" 5.2 16437 2005 1 183 16710 4 2005
    2006 "ALBANIA" 4.5 16802 2006 1 184 16802 1 2006
    2006 "ALBANIA" 4.5 16802 2006 1 185 16892 2 2006
    2006 "ALBANIA" 4.5 16802 2006 1 186 16983 3 2006
    2006 "ALBANIA" 4.5 16802 2006 1 187 17075 4 2006
    2007 "ALBANIA" 4.5 17167 2007 1 188 17167 1 2007
    2007 "ALBANIA" 4.5 17167 2007 1 189 17257 2 2007
    2007 "ALBANIA" 4.5 17167 2007 1 190 17348 3 2007
    2007 "ALBANIA" 4.5 17167 2007 1 191 17440 4 2007
    2014 "ALBANIA" 5 19724 2014 1 216 19724 1 2014
    2014 "ALBANIA" 5 19724 2014 1 217 19814 2 2014

    Can you help me to identify the error?
    Thank you in advance.

  • #2
    you can use the -duplicates- command to find observations that are duplicates on "yr quarter country" - depending on how many you think there are use either duplicates list or duplicates examples or duplicates tag; see
    Code:
    help duplicates

    Comment


    • #3
      Hello,

      Thank you for your message. I tried to use the - report duplicates - command after the aforementioned error and I received the following message:


      Duplicates in terms of yr quarter country

      --------------------------------------
      copies | observations surplus
      ----------+---------------------------
      1 | 50704 0
      --------------------------------------

      With the command - duplicates list - I received the following information:

      Duplicates in terms of all variables

      (0 observations are duplicates)

      There is any other way to find the problem?
      Thank you in advance.

      Comment


      • #4
        it sounds as though you ran the -duplicates- command on the master data - but the error message your report in #1 is for the using data

        Comment

        Working...
        X