Announcement

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

  • How to check if I have duplicates without perfectly duplicated obs

    Dear All,

    I am a long data, with duplicated IDs, as there are obs for different dates. I would like to check if there are difference between the variables for each ID and Date (as my title say: duplicates without perfectly duplicated obs)

    Code:
      
     input id date char1 char2 char3 char4
    1 1/1/2009 4 5 4 0  
    1 2/22009 4 5 5 10
    1 3/3/2009 4 5 4 10
    1 4/4/2009 4 5 4 10
     1 5/5/2009 4 5 4 10  
    end
    I have tried to use duplicates, but I have more than 40 variables, so it is practical to use

    I have also tried to use collapse (checked the help in stata) but don't know if its the correct way to go.

    Code:
    ds date, not
    collapse (lastnm) `r(varlist)', by(date)
    Thank you for your help in advance.
    Last edited by Hatim Tareq; 30 Oct 2019, 14:06.

  • #2
    Any help please.

    Comment


    • #3
      Code:
      duplicates list char1-char4
      would with your example indicate that there are duplicates on those variables. And so on.
      Last edited by Nick Cox; 31 Oct 2019, 05:01.

      Comment


      • #4
        Thank you Nick.

        I think it works, I will investigate the output and let you know.

        Thank you for you help.
        Last edited by Hatim Tareq; 31 Oct 2019, 04:42.

        Comment

        Working...
        X