Announcement

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

  • duplicate

    i have duplicate in the names have the same id but i need to keep one of each duplicates
    like

    1 Amel
    1 Amel
    2 Mona
    3 Ali
    4 Mona

    i need the ruselt
    1 Amel
    2 Mona
    3 Ali
    4 Mona

  • #2
    Code:
    help duplicates

    Comment


    • #3
      I need more help
      I want to remove one of duplicate and keep the other
      Last edited by Hope Ahmed; 08 Apr 2023, 07:20.

      Comment


      • #4
        That help duplicates really contains all the helps one would need, presented in a very learner-friendly and comprehensive manner.

        Click on the PDF version and locate the page about this command, and there you'd find some quick use cases on how to do that. Take deep breath and read it. On either the online or the PDF version, at the end you'll also find a video link demonstrating how to deduplicate.

        Comment


        • #5
          Hope:
          you may want to try:
          Code:
          . bysort id: keep if _n==1
          
          
          . list
          
               +-----------+
               | id   Name |
               |-----------|
            1. |  1   Amel |
            2. |  2   Mona |
            3. |  3    Ali |
            4. |  4   Mona |
               +-----------+
          
          .
          Kind regards,
          Carlo
          (Stata 19.0)

          Comment

          Working...
          X