<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Checking for duplicates in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Checking-for-duplicates/m-p/238302#M43775</link>
    <description>&lt;P&gt;Thanks Steelers and&amp;nbsp;RW9!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Is there a way to identify, for each record in a dataset, the degree to which all the variable reponses&amp;nbsp;(or&amp;nbsp;a subset of variable responses) matches the&amp;nbsp;the variable reponses&amp;nbsp;(or&amp;nbsp;a subset of variable responses)&amp;nbsp; for each other record in the dataset?&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;I could then hand review only those records with a very high "matching score" to identify duplicates.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For context: I'm asking if there s way to do something like this in SAS because although the programs where the data is collect from assign Patient IDs uniquely, the dataset is gathered from data entry done from paper forms; sometimes a form is data entered twice by two diff people who enter different patient ID s for the same person.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 08 Dec 2015 15:45:05 GMT</pubDate>
    <dc:creator>Maisha_Huq</dc:creator>
    <dc:date>2015-12-08T15:45:05Z</dc:date>
    <item>
      <title>Checking for duplicates</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Checking-for-duplicates/m-p/238266#M43758</link>
      <description>&lt;P&gt;Hi there,&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;Whatr are possibilities to check for duplicates in a dataset where the expectation is that the duplicate entries for the same, say, patient will&amp;nbsp;have differences in data entry for the&amp;nbsp;key identifying variables (i.e. patient ID, date of visit, program name)?&amp;nbsp; The rest of the variables, say, v1 - v20, however, may be the same.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Normally i may have : (i) used the nodup key, or (ii) created a concatenation of key identifying variables and singled out non-unique records for manual review.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In this case, would a sort of probabilistic data matching work better? what are ways to do this in sas?&lt;/P&gt;
&lt;P&gt;Let me know if I can clarify -thank you!&lt;/P&gt;</description>
      <pubDate>Tue, 08 Dec 2015 14:12:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Checking-for-duplicates/m-p/238266#M43758</guid>
      <dc:creator>Maisha_Huq</dc:creator>
      <dc:date>2015-12-08T14:12:51Z</dc:date>
    </item>
    <item>
      <title>Re: Checking for duplicates</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Checking-for-duplicates/m-p/238274#M43759</link>
      <description>&lt;P&gt;Can you give an example dataset, where you have some entries that you want to be captured and others that you do not?&lt;/P&gt;</description>
      <pubDate>Tue, 08 Dec 2015 14:23:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Checking-for-duplicates/m-p/238274#M43759</guid>
      <dc:creator>Steelers_In_DC</dc:creator>
      <dc:date>2015-12-08T14:23:49Z</dc:date>
    </item>
    <item>
      <title>Re: Checking for duplicates</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Checking-for-duplicates/m-p/238275#M43760</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So how does your data look. &amp;nbsp;The reason I ask is because you mention there are data entry differences in Patient ID. &amp;nbsp;Now dates I could understand, but Patient ID is a fixed Identification number (hence the name), if that is different then I see no way of acurately identifying tht subjects data, nor would any process using that data be within compliance. &amp;nbsp;An ID is specifically that, and should be set by a pre-generated randomisation list, and only created as the subject folder. &amp;nbsp;There should be no differences, unless the subject gets re-randomised and gets another number.&lt;/P&gt;</description>
      <pubDate>Tue, 08 Dec 2015 14:26:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Checking-for-duplicates/m-p/238275#M43760</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2015-12-08T14:26:30Z</dc:date>
    </item>
    <item>
      <title>Re: Checking for duplicates</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Checking-for-duplicates/m-p/238281#M43761</link>
      <description>&lt;P&gt;&amp;nbsp;Hi Maisha,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you want to check which duplicates you have, you could do something like this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am assuming that a patientID never changes, but the programname and date for that person can change (multiple visits).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;proc sql;&lt;/P&gt;
&lt;P&gt;create table dupes as&lt;/P&gt;
&lt;P&gt;select distinct PatientID, Date, ProgramName, Count(*) as Count&lt;/P&gt;
&lt;P&gt;from input_base&lt;/P&gt;
&lt;P&gt;group by&amp;nbsp;&lt;SPAN&gt;PatientID, Date, ProgramName&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;having count&amp;gt;=2;&lt;/P&gt;
&lt;P&gt;quit;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 08 Dec 2015 14:52:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Checking-for-duplicates/m-p/238281#M43761</guid>
      <dc:creator>morglum</dc:creator>
      <dc:date>2015-12-08T14:52:38Z</dc:date>
    </item>
    <item>
      <title>Re: Checking for duplicates</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Checking-for-duplicates/m-p/238302#M43775</link>
      <description>&lt;P&gt;Thanks Steelers and&amp;nbsp;RW9!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Is there a way to identify, for each record in a dataset, the degree to which all the variable reponses&amp;nbsp;(or&amp;nbsp;a subset of variable responses) matches the&amp;nbsp;the variable reponses&amp;nbsp;(or&amp;nbsp;a subset of variable responses)&amp;nbsp; for each other record in the dataset?&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;I could then hand review only those records with a very high "matching score" to identify duplicates.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For context: I'm asking if there s way to do something like this in SAS because although the programs where the data is collect from assign Patient IDs uniquely, the dataset is gathered from data entry done from paper forms; sometimes a form is data entered twice by two diff people who enter different patient ID s for the same person.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 08 Dec 2015 15:45:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Checking-for-duplicates/m-p/238302#M43775</guid>
      <dc:creator>Maisha_Huq</dc:creator>
      <dc:date>2015-12-08T15:45:05Z</dc:date>
    </item>
    <item>
      <title>Re: Checking for duplicates</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Checking-for-duplicates/m-p/238315#M43783</link>
      <description>&lt;P&gt;Without an example dataset to work from I am guessing and making this up as I go along.&amp;nbsp; This will give you each individual ID number and how many columns they have that are matching.&amp;nbsp; It does not show what the differences are, only the amount of columns that are the same between two datasets:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data one;&lt;BR /&gt;input id$ var1 var2 var3;&lt;BR /&gt;cards;&lt;BR /&gt;100 1 1 1&lt;BR /&gt;200 2 2 2&lt;BR /&gt;300 3 3 3&lt;BR /&gt;;&lt;BR /&gt;&lt;BR /&gt;data two;&lt;BR /&gt;input id$ var1 var2 var3;&lt;BR /&gt;cards;&lt;BR /&gt;100 1 0 0&lt;BR /&gt;200 1 1 1&lt;BR /&gt;300 3 3 3&lt;BR /&gt;;&lt;BR /&gt;&lt;BR /&gt;proc transpose data=one out=tranone;by id;&lt;BR /&gt;&lt;BR /&gt;proc transpose data=two out=trantwo(rename=(col1 = COL2));by id;&lt;BR /&gt;&lt;BR /&gt;data prep;&lt;BR /&gt;merge tranone(in=a)&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; trantwo(in=b);&lt;BR /&gt;by id;&lt;BR /&gt;if a and b and col1 = col2;&lt;BR /&gt;count + 1;&lt;BR /&gt;if first.id then count = 1;&lt;BR /&gt;run;&lt;BR /&gt;&lt;BR /&gt;data want;&lt;BR /&gt;set prep;&lt;BR /&gt;by id;&lt;BR /&gt;if last.id then output;&lt;BR /&gt;keep id count;&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 08 Dec 2015 16:04:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Checking-for-duplicates/m-p/238315#M43783</guid>
      <dc:creator>Steelers_In_DC</dc:creator>
      <dc:date>2015-12-08T16:04:08Z</dc:date>
    </item>
    <item>
      <title>Re: Checking for duplicates</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Checking-for-duplicates/m-p/238324#M43787</link>
      <description>Let's talk about the scope of such an endeavor, which is not to say it's not impossible.  First you have multiple records for each person. To determine if someone else is the same 'person' based solely on answers wouldn't you need to compare their answers to every other users answers.  And if you expect the answers to be the same, why are you taking multiple measurements, or is safe to assume that the person would respond on the same date.  &lt;BR /&gt;&lt;BR /&gt;This type of analysis is called collusion analysis and would be similar to the algorithms that check for someone cheating on an exam.  Your multiple answer scenario complicates it a bit, or make it more simple if you can consider the multiple responses and better indicators of a match.&lt;BR /&gt;&lt;BR /&gt;That being said...I would have no idea how to implement such a method in SAS &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;</description>
      <pubDate>Tue, 08 Dec 2015 16:20:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Checking-for-duplicates/m-p/238324#M43787</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2015-12-08T16:20:39Z</dc:date>
    </item>
  </channel>
</rss>

