<?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: merging with visit dates (visit dates are repeated in both datasets) in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/merging-with-visit-dates-visit-dates-are-repeated-in-both/m-p/473185#M121390</link>
    <description>&lt;P&gt;&amp;nbsp;Let's bring this back to your other question then:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data LAB;&lt;/P&gt;
&lt;P&gt;input visit_dt date mmddyy10. Bdate date mmddyy10. Test&amp;nbsp; testresult $;&lt;/P&gt;
&lt;P&gt;format date mmddyy10.;&lt;/P&gt;
&lt;P&gt;cards;&lt;/P&gt;
&lt;P&gt;03/13/2018&amp;nbsp; 02/27/1931&amp;nbsp; 1&amp;nbsp; N&lt;/P&gt;
&lt;P&gt;02/26/2018 10/21/1944&amp;nbsp; 10&amp;nbsp; P&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;02/13/2018&amp;nbsp; 03/06/1978&amp;nbsp; 1&amp;nbsp;&amp;nbsp; N&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;02/13/2018&amp;nbsp; 03/06/1978&amp;nbsp; 1&amp;nbsp;&amp;nbsp; N&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;01/26/2018&amp;nbsp; 04/14/1949&amp;nbsp;&amp;nbsp; 1&amp;nbsp; N&lt;/P&gt;
&lt;P&gt;02/06/2018&amp;nbsp; 04/14/1949&amp;nbsp; 1&amp;nbsp; P&lt;/P&gt;
&lt;P&gt;; RUN;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data CLINIC;&lt;/P&gt;
&lt;P&gt;input visit_dt Bdate date clinic $ diag;&lt;/P&gt;
&lt;P&gt;format date mmddyy10.;&lt;/P&gt;
&lt;P&gt;cards;&lt;/P&gt;
&lt;P&gt;03/13/2018&amp;nbsp; 02/27/1931&amp;nbsp; mmc 200&lt;/P&gt;
&lt;P&gt;01/19/2018 10/06/1934&amp;nbsp; mmc&amp;nbsp; 300&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;02/13/2018&amp;nbsp; 03/06/1978&amp;nbsp; mmc&amp;nbsp; 300&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;02/13/2018&amp;nbsp; 03/06/1978&amp;nbsp; mmc &amp;nbsp;300&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;01/26/2018&amp;nbsp; 04/14/1949&amp;nbsp;&amp;nbsp; mmc 200&lt;/P&gt;
&lt;P&gt;02/06/2018&amp;nbsp; 04/14/1949&amp;nbsp; mmc&amp;nbsp; 300&lt;/P&gt;
&lt;P&gt;;&lt;/P&gt;
&lt;P&gt;RUN;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Let's look at the coloured lines above which are the same person (assumption). What EXACTLY do you want as your final output?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/68306"&gt;@DhanaMalla&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Hi Reeza,&lt;/P&gt;
&lt;P&gt;Don't know how to say. So I have multiple in data1 and multiple in data2 in some case but in some case I have 1 in set one ands multiple in another case. Same person can have multiple tests on the same day and same day multiples patients get tested. I am trying to find the number of tests and test results.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;If you don't know, there's no way I can know, especially from the outside looking in. This is a logical decision, not a programming problem per se.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If your final requirement is # of tests and results then you may have different options that don't require merging, unless you need to link the lab test to the results directly and if you do, this is a horrible method to do it and I'd expect your system to have identifiers that link the two - whether or not you have access to that is a different story, but they would have to exist somewhere or you'd have a massive data integrity problem.&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 25 Jun 2018 22:02:03 GMT</pubDate>
    <dc:creator>Reeza</dc:creator>
    <dc:date>2018-06-25T22:02:03Z</dc:date>
    <item>
      <title>merging with visit dates (visit dates are repeated in both datasets)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/merging-with-visit-dates-visit-dates-are-repeated-in-both/m-p/471519#M120789</link>
      <description>&lt;P&gt;Hi I am trying to merge two datasets with visit dates. Both datasets have repeated visit date and this (below) is the message I see in log. Please help&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;DATA FIRSTQTR.MRGD_KHCMHDL;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;MERGE FIRSTQTR.KHC_DATA_A FIRSTQTR.MHDL_DATA_D;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;BY VISIT_DT;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;RUN;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;the log says;&lt;/P&gt;&lt;P&gt;&amp;nbsp;MERGE statements has more than one dataset with repeats of By values.&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&lt;/STRONG&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 19 Jun 2018 20:54:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/merging-with-visit-dates-visit-dates-are-repeated-in-both/m-p/471519#M120789</guid>
      <dc:creator>DhanaMalla</dc:creator>
      <dc:date>2018-06-19T20:54:53Z</dc:date>
    </item>
    <item>
      <title>Re: merging with visit dates (visit dates are repeated in both datasets)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/merging-with-visit-dates-visit-dates-are-repeated-in-both/m-p/471520#M120790</link>
      <description>&lt;P&gt;A data step merge cannot do a many to many join which is what this would be. In the majority of cases this means you need another variable in your BY statement that would uniquely identify each match - BY some sort of ID as well?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Are you sure many to many is what you want? That would mean if you have 2 records in one file and 3 records in another you're going to end up with 6 records in total.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/68306"&gt;@DhanaMalla&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Hi I am trying to merge two datasets with visit dates. Both datasets have repeated visit date and this (below) is the message I see in log. Please help&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;DATA FIRSTQTR.MRGD_KHCMHDL;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;MERGE FIRSTQTR.KHC_DATA_A FIRSTQTR.MHDL_DATA_D;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;BY VISIT_DT;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;RUN;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;the log says;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;MERGE statements has more than one dataset with repeats of By values.&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&lt;/STRONG&gt;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 19 Jun 2018 20:57:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/merging-with-visit-dates-visit-dates-are-repeated-in-both/m-p/471520#M120790</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-06-19T20:57:38Z</dc:date>
    </item>
    <item>
      <title>Re: merging with visit dates (visit dates are repeated in both datasets)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/merging-with-visit-dates-visit-dates-are-repeated-in-both/m-p/472967#M121315</link>
      <description />
      <pubDate>Mon, 25 Jun 2018 13:03:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/merging-with-visit-dates-visit-dates-are-repeated-in-both/m-p/472967#M121315</guid>
      <dc:creator>DhanaMalla</dc:creator>
      <dc:date>2018-06-25T13:03:11Z</dc:date>
    </item>
    <item>
      <title>Re: merging with visit dates (visit dates are repeated in both datasets)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/merging-with-visit-dates-visit-dates-are-repeated-in-both/m-p/472973#M121317</link>
      <description>&lt;P&gt;HI Reeza,&lt;/P&gt;&lt;P&gt;So then&amp;nbsp;I should porbably&amp;nbsp;use Visit&amp;nbsp;id and &amp;nbsp;DOB variable.&amp;nbsp; One of my friends said he did it by converting the dates to sequential serial numbers and then concatonated those two numbers into one 10 digit number, and matched on that.&amp;nbsp; He did&amp;nbsp;it in Epiinfo, there might be a way to do what he did&amp;nbsp;in SAS, but I don't know. It would be great if you can help with that.&amp;nbsp;&lt;BR /&gt;Thank you so much.&lt;/P&gt;</description>
      <pubDate>Mon, 25 Jun 2018 13:08:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/merging-with-visit-dates-visit-dates-are-repeated-in-both/m-p/472973#M121317</guid>
      <dc:creator>DhanaMalla</dc:creator>
      <dc:date>2018-06-25T13:08:15Z</dc:date>
    </item>
    <item>
      <title>Re: merging with visit dates (visit dates are repeated in both datasets)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/merging-with-visit-dates-visit-dates-are-repeated-in-both/m-p/473045#M121341</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/68306"&gt;@DhanaMalla&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;One of my friends said he did it by converting the dates to sequential serial numbers and then concatonated those two numbers into one 10 digit number, and matched on that.&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;That's the old fashioned way of doing it. You can have two variables in your BY statement.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Your question and Merge question so far, neither actually show what you want as output, just have two different source data sets. If you can't show us what you want as the output, we can make guesses but that's about it.&lt;/P&gt;</description>
      <pubDate>Mon, 25 Jun 2018 15:31:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/merging-with-visit-dates-visit-dates-are-repeated-in-both/m-p/473045#M121341</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-06-25T15:31:09Z</dc:date>
    </item>
    <item>
      <title>Re: merging with visit dates (visit dates are repeated in both datasets)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/merging-with-visit-dates-visit-dates-are-repeated-in-both/m-p/473057#M121344</link>
      <description>Reeza,&lt;BR /&gt;I know I am not being very explicit about what I have and what I want. Let me try to explain as clear as I can. I did ORDER=FREQ and NLEVELS&lt;BR /&gt;To identify duplicates, and this is what I found out.&lt;BR /&gt;I have two datasets. This data set has other variables for example test type and test result. Datasets A (lab data) has 932 unique DOB, of these Of 932 DOB:&lt;BR /&gt;443 DOB IS REPEATED TWICE&lt;BR /&gt;94 IS REPEATED THREE TIMES&lt;BR /&gt;23 REPEATED FOURTIMES&lt;BR /&gt;9 REPEATED 5 TIMES&lt;BR /&gt;4 REPEATED SIX TIMES&lt;BR /&gt;2 REPEATED 7 TIMES&lt;BR /&gt;&lt;BR /&gt;This data set also has other variables for example test type and test result. Data set B has 899 (clinic data) DOB, Of 899 DOB:&lt;BR /&gt;127 is repeated twice&lt;BR /&gt;37 is repeated three times&lt;BR /&gt;3 is repeated four times.&lt;BR /&gt;And both dataset has visit date which is repeated as many as 39 times meaning that date that many test were conducted.&lt;BR /&gt;&lt;BR /&gt;So what I am trying to get is find out number and type of tests done, and number of test results negative or positive by merging these two data set. your help will be really appreciated.&lt;BR /&gt;</description>
      <pubDate>Mon, 25 Jun 2018 16:01:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/merging-with-visit-dates-visit-dates-are-repeated-in-both/m-p/473057#M121344</guid>
      <dc:creator>DhanaMalla</dc:creator>
      <dc:date>2018-06-25T16:01:15Z</dc:date>
    </item>
    <item>
      <title>Re: merging with visit dates (visit dates are repeated in both datasets)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/merging-with-visit-dates-visit-dates-are-repeated-in-both/m-p/473069#M121349</link>
      <description>&lt;P&gt;I understand what you have.&amp;nbsp; I don't understand what you want.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Take one ID, with say X records in data1 and Y records in data2 and show exactly what you want as output.&lt;/P&gt;
&lt;P&gt;Ideally, you would also include cases such as:&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;1 record in data1 and multiple in data2&lt;/LI&gt;
&lt;LI&gt;multiple in data1 and 1 in data2&lt;/LI&gt;
&lt;LI&gt;multiple in data1 and multiple in data2&lt;/LI&gt;
&lt;LI&gt;1/multiple in data2 and 0 in data2&lt;/LI&gt;
&lt;LI&gt;0 in data2 and 1/multiple in data2&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;These are the case types I'd check to ensure the merge was happening the way I wanted it to.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/68306"&gt;@DhanaMalla&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;Reeza,&lt;BR /&gt;I know I am not being very explicit about what I have and what I want. Let me try to explain as clear as I can. I did ORDER=FREQ and NLEVELS&lt;BR /&gt;To identify duplicates, and this is what I found out.&lt;BR /&gt;I have two datasets. This data set has other variables for example test type and test result. Datasets A (lab data) has 932 unique DOB, of these Of 932 DOB:&lt;BR /&gt;443 DOB IS REPEATED TWICE&lt;BR /&gt;94 IS REPEATED THREE TIMES&lt;BR /&gt;23 REPEATED FOURTIMES&lt;BR /&gt;9 REPEATED 5 TIMES&lt;BR /&gt;4 REPEATED SIX TIMES&lt;BR /&gt;2 REPEATED 7 TIMES&lt;BR /&gt;&lt;BR /&gt;This data set also has other variables for example test type and test result. Data set B has 899 (clinic data) DOB, Of 899 DOB:&lt;BR /&gt;127 is repeated twice&lt;BR /&gt;37 is repeated three times&lt;BR /&gt;3 is repeated four times.&lt;BR /&gt;And both dataset has visit date which is repeated as many as 39 times meaning that date that many test were conducted.&lt;BR /&gt;&lt;BR /&gt;So what I am trying to get is find out number and type of tests done, and number of test results negative or positive by merging these two data set. your help will be really appreciated.&lt;BR /&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 25 Jun 2018 17:11:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/merging-with-visit-dates-visit-dates-are-repeated-in-both/m-p/473069#M121349</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-06-25T17:11:06Z</dc:date>
    </item>
    <item>
      <title>Re: merging with visit dates (visit dates are repeated in both datasets)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/merging-with-visit-dates-visit-dates-are-repeated-in-both/m-p/473154#M121381</link>
      <description>&lt;P&gt;Hi Reeza,&lt;/P&gt;&lt;P&gt;I have 1109 visit date data in set 1 (clinic visit data)and I have 1704 visit date data in another set Lab test data). I have 899 unique patient in set 1 and 932 in set 2. Don't know how to say. So I have multiple in data1 and multiple in data2 in some case but in some case I have 1 in set one ands multiple in another case. Same person can have multiple tests on the same day and same day multiples patients get tested. I am trying to find the number of tests and test results.&lt;/P&gt;</description>
      <pubDate>Mon, 25 Jun 2018 20:12:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/merging-with-visit-dates-visit-dates-are-repeated-in-both/m-p/473154#M121381</guid>
      <dc:creator>DhanaMalla</dc:creator>
      <dc:date>2018-06-25T20:12:19Z</dc:date>
    </item>
    <item>
      <title>Re: merging with visit dates (visit dates are repeated in both datasets)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/merging-with-visit-dates-visit-dates-are-repeated-in-both/m-p/473185#M121390</link>
      <description>&lt;P&gt;&amp;nbsp;Let's bring this back to your other question then:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data LAB;&lt;/P&gt;
&lt;P&gt;input visit_dt date mmddyy10. Bdate date mmddyy10. Test&amp;nbsp; testresult $;&lt;/P&gt;
&lt;P&gt;format date mmddyy10.;&lt;/P&gt;
&lt;P&gt;cards;&lt;/P&gt;
&lt;P&gt;03/13/2018&amp;nbsp; 02/27/1931&amp;nbsp; 1&amp;nbsp; N&lt;/P&gt;
&lt;P&gt;02/26/2018 10/21/1944&amp;nbsp; 10&amp;nbsp; P&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;02/13/2018&amp;nbsp; 03/06/1978&amp;nbsp; 1&amp;nbsp;&amp;nbsp; N&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;02/13/2018&amp;nbsp; 03/06/1978&amp;nbsp; 1&amp;nbsp;&amp;nbsp; N&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;01/26/2018&amp;nbsp; 04/14/1949&amp;nbsp;&amp;nbsp; 1&amp;nbsp; N&lt;/P&gt;
&lt;P&gt;02/06/2018&amp;nbsp; 04/14/1949&amp;nbsp; 1&amp;nbsp; P&lt;/P&gt;
&lt;P&gt;; RUN;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data CLINIC;&lt;/P&gt;
&lt;P&gt;input visit_dt Bdate date clinic $ diag;&lt;/P&gt;
&lt;P&gt;format date mmddyy10.;&lt;/P&gt;
&lt;P&gt;cards;&lt;/P&gt;
&lt;P&gt;03/13/2018&amp;nbsp; 02/27/1931&amp;nbsp; mmc 200&lt;/P&gt;
&lt;P&gt;01/19/2018 10/06/1934&amp;nbsp; mmc&amp;nbsp; 300&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;02/13/2018&amp;nbsp; 03/06/1978&amp;nbsp; mmc&amp;nbsp; 300&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;02/13/2018&amp;nbsp; 03/06/1978&amp;nbsp; mmc &amp;nbsp;300&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;01/26/2018&amp;nbsp; 04/14/1949&amp;nbsp;&amp;nbsp; mmc 200&lt;/P&gt;
&lt;P&gt;02/06/2018&amp;nbsp; 04/14/1949&amp;nbsp; mmc&amp;nbsp; 300&lt;/P&gt;
&lt;P&gt;;&lt;/P&gt;
&lt;P&gt;RUN;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Let's look at the coloured lines above which are the same person (assumption). What EXACTLY do you want as your final output?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/68306"&gt;@DhanaMalla&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Hi Reeza,&lt;/P&gt;
&lt;P&gt;Don't know how to say. So I have multiple in data1 and multiple in data2 in some case but in some case I have 1 in set one ands multiple in another case. Same person can have multiple tests on the same day and same day multiples patients get tested. I am trying to find the number of tests and test results.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;If you don't know, there's no way I can know, especially from the outside looking in. This is a logical decision, not a programming problem per se.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If your final requirement is # of tests and results then you may have different options that don't require merging, unless you need to link the lab test to the results directly and if you do, this is a horrible method to do it and I'd expect your system to have identifiers that link the two - whether or not you have access to that is a different story, but they would have to exist somewhere or you'd have a massive data integrity problem.&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 25 Jun 2018 22:02:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/merging-with-visit-dates-visit-dates-are-repeated-in-both/m-p/473185#M121390</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-06-25T22:02:03Z</dc:date>
    </item>
    <item>
      <title>Re: merging with visit dates (visit dates are repeated in both datasets)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/merging-with-visit-dates-visit-dates-are-repeated-in-both/m-p/473433#M121494</link>
      <description>&lt;P&gt;&lt;SPAN&gt;Hi Reeza,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Thank you for still being with me. Hope you will be with me until I am able to solve this problem.&amp;nbsp; So I guess this is what I want&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;03/13/2018&amp;nbsp; 02/27/1931&amp;nbsp; 1&amp;nbsp; N mmc 200&lt;/P&gt;&lt;P&gt;03/13/2018&amp;nbsp; 02/27/1931&amp;nbsp; 1&amp;nbsp; N mmc 200&lt;/P&gt;&lt;P&gt;01/19/2018 10/06/1934&amp;nbsp; mmc&amp;nbsp; 300&lt;/P&gt;&lt;P&gt;02/26/2018 10/21/1944&amp;nbsp; 10&amp;nbsp; P&lt;/P&gt;&lt;P&gt;02/13/2018&amp;nbsp; 03/06/1978&amp;nbsp; 1&amp;nbsp;&amp;nbsp; N mmc &amp;nbsp;300&lt;/P&gt;&lt;P&gt;02/13/2018&amp;nbsp; 03/06/1978&amp;nbsp; 1&amp;nbsp;&amp;nbsp; N mmc&amp;nbsp; 300&lt;/P&gt;&lt;P&gt;01/26/2018&amp;nbsp; 04/14/1949&amp;nbsp;&amp;nbsp; 1&amp;nbsp; N mmc 200&lt;/P&gt;&lt;P&gt;02/06/2018&amp;nbsp; 04/14/1949&amp;nbsp; 1&amp;nbsp; P mmc&amp;nbsp; 300&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I want everything for the lab data with added info from clinic if available. &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Reeza,&lt;/P&gt;&lt;P&gt;May be this might give you an idea better.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&lt;P&gt;&lt;STRONG&gt;Lab&lt;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t;&lt;TR&gt;&lt;TD&gt;&lt;P&gt;G&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;P&gt;H&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;MISSING&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;P&gt;I&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;I&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;P&gt;J&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;J&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;J&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;J&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;In the table above, person A &amp;amp; B visit clinic and get tested so I have info in both data sets. Person C visited clinic once, but got two tests done. Person D visited clinic twice, tested twice. Person E &amp;amp; F visited clinic and got tested. Person G visited clinic once and tested twice or had two different tests done. Person H is not in clinic data set. Person J visited clinic four times but only had two tests done. This is the pattern of the two datasets I am trying to merge. Your help will be appreciated.&lt;/P&gt;</description>
      <pubDate>Tue, 26 Jun 2018 15:26:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/merging-with-visit-dates-visit-dates-are-repeated-in-both/m-p/473433#M121494</guid>
      <dc:creator>DhanaMalla</dc:creator>
      <dc:date>2018-06-26T15:26:30Z</dc:date>
    </item>
    <item>
      <title>Re: merging with visit dates (visit dates are repeated in both datasets)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/merging-with-visit-dates-visit-dates-are-repeated-in-both/m-p/473539#M121541</link>
      <description>&lt;P&gt;For each of your data sets go through and create a sequence number. I'm assuming you also have some sort of ID variable?&lt;/P&gt;
&lt;P&gt;&lt;A href="https://stats.idre.ucla.edu/sas/faq/how-can-i-create-an-enumeration-variable-by-groups/" target="_blank"&gt;https://stats.idre.ucla.edu/sas/faq/how-can-i-create-an-enumeration-variable-by-groups/&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Once you have your sequence number you can merge&amp;nbsp;using a "BY ID testdate Sequence"&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/68306"&gt;@DhanaMalla&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;&lt;SPAN&gt;Hi Reeza,&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Thank you for still being with me. Hope you will be with me until I am able to solve this problem.&amp;nbsp; So I guess this is what I want&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;03/13/2018&amp;nbsp; 02/27/1931&amp;nbsp; 1&amp;nbsp; N mmc 200&lt;/P&gt;
&lt;P&gt;03/13/2018&amp;nbsp; 02/27/1931&amp;nbsp; 1&amp;nbsp; N mmc 200&lt;/P&gt;
&lt;P&gt;01/19/2018 10/06/1934&amp;nbsp; mmc&amp;nbsp; 300&lt;/P&gt;
&lt;P&gt;02/26/2018 10/21/1944&amp;nbsp; 10&amp;nbsp; P&lt;/P&gt;
&lt;P&gt;02/13/2018&amp;nbsp; 03/06/1978&amp;nbsp; 1&amp;nbsp;&amp;nbsp; N mmc &amp;nbsp;300&lt;/P&gt;
&lt;P&gt;02/13/2018&amp;nbsp; 03/06/1978&amp;nbsp; 1&amp;nbsp;&amp;nbsp; N mmc&amp;nbsp; 300&lt;/P&gt;
&lt;P&gt;01/26/2018&amp;nbsp; 04/14/1949&amp;nbsp;&amp;nbsp; 1&amp;nbsp; N mmc 200&lt;/P&gt;
&lt;P&gt;02/06/2018&amp;nbsp; 04/14/1949&amp;nbsp; 1&amp;nbsp; P mmc&amp;nbsp; 300&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;I want everything for the lab data with added info from clinic if available. &lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Reeza,&lt;/P&gt;
&lt;P&gt;May be this might give you an idea better.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;TABLE&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD&gt;
&lt;P&gt;&lt;STRONG&gt;Lab&lt;/STRONG&gt;&lt;/P&gt;
&lt;/TD&gt;
&lt;TD&gt;
&lt;P&gt;&lt;STRONG&gt;Clinic&lt;/STRONG&gt;&lt;/P&gt;
&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;
&lt;P&gt;A&lt;/P&gt;
&lt;/TD&gt;
&lt;TD&gt;
&lt;P&gt;A&lt;/P&gt;
&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;
&lt;P&gt;B&lt;/P&gt;
&lt;/TD&gt;
&lt;TD&gt;
&lt;P&gt;B&lt;/P&gt;
&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;
&lt;P&gt;C&lt;/P&gt;
&lt;/TD&gt;
&lt;TD&gt;
&lt;P&gt;C&lt;/P&gt;
&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;
&lt;P&gt;C&lt;/P&gt;
&lt;/TD&gt;
&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;
&lt;P&gt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t;TD&gt;
&lt;P&gt;J&lt;/P&gt;
&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD&gt;
&lt;P&gt;J&lt;/P&gt;
&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;In the table above, person A &amp;amp; B visit clinic and get tested so I have info in both data sets. Person C visited clinic once, but got two tests done. Person D visited clinic twice, tested twice. Person E &amp;amp; F visited clinic and got tested. Person G visited clinic once and tested twice or had two different tests done. Person H is not in clinic data set. Person J visited clinic four times but only had two tests done. This is the pattern of the two datasets I am trying to merge. Your help will be appreciated.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 26 Jun 2018 20:23:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/merging-with-visit-dates-visit-dates-are-repeated-in-both/m-p/473539#M121541</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-06-26T20:23:34Z</dc:date>
    </item>
  </channel>
</rss>

