Announcement

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

  • remove rows with similar content and assign new variable

    Dear all,

    I have a dataset like this
    Code:
    index patient_name1 patient_name2
    1  "aaa" "aab"
    2 "zyy" "zkk"
    3 "aab" "aaa"
    4 "zkk" "zyy"
    I want to remove rows that has similar content with other observations across variables. For example, 'patient_name1' in row 1 is the same as 'patient_name2' in row 3, while 'patient_name2' in row 1 is the same as 'patient_name1' in row 3. So in this case I would like to remove both row 3 and row 4. Is there any way that I could do so? Thanks in advance!
    Last edited by Evon Pong; 08 Jun 2022, 10:59.

  • #2
    the following is untested as you did not follow the advice in the FAQ - I would start by using the user-written -rowsort- command (from SJ) which can be found and downloaded using the -search- command; I would then use the -duplicates- command; see
    Code:
    h search
    h duplicates

    Comment


    • #3
      Hi Rich,

      Thank you for replying to my post. I am new to Statalist so I am still not very familiar with the advice on FAQ. May I know is it that the way that I present my dataset violates the advice given on FAQ? Many thanks!

      Comment


      • #4
        The FAQ is mentioned on the home page, and each time you start a thread. Here is the link again. https://www.statalist.org/forums/help See especially #12.

        Comment

        Working...
        X