<?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: Complicated merging question in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Complicated-merging-question/m-p/265256#M269276</link>
    <description>&lt;P&gt;This is likely going to be a job for Proc SQL in any form.&lt;/P&gt;
&lt;P&gt;If the variables you need to match on have the same names in both sets a NATURAL JOIN may work.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
   create table want as
   select setone.*, settwo.* 
   from setone natural join settwo;
quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;or use a specific join criteria&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
   create table want as
   select setone.*, settwo.* 
   from setone  join settwo
      on setone.id=settwo.id and setone.dob=settwo.dob 
         and setone.site=settwo.site and setone.visitdate=settwo.visitdate
quit; &lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Wed, 20 Apr 2016 22:12:50 GMT</pubDate>
    <dc:creator>ballardw</dc:creator>
    <dc:date>2016-04-20T22:12:50Z</dc:date>
    <item>
      <title>Complicated merging question</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Complicated-merging-question/m-p/265249#M269275</link>
      <description>&lt;P&gt;I have a complicated merging question that may not even be possible in SAS. I have two datasets on testing results for a certain condition. One has names of patient, dob, date of visit, site number, and client ID. The other one has dob, date of visit, site number, and client id in addition to risk behavior questions,demographic information,&amp;nbsp;and test results.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want to merge these two datasets to get one observation per each visit for each client, and also have a way to display this information in&amp;nbsp;wide&amp;nbsp;format&amp;nbsp;when I need to do longitudinal analysis&amp;nbsp;.&amp;nbsp;The only thing is, there is a chance that the client ID has been used on multiple people (not that often, but a few instances of it) This is usually because different testing sites might both assign the same number for the respecitve patients. This means I need to merge not only on client ID, but DOB (assuming the chance that two people who have the same ID had the same DOB is close to 0), site number, and date of visit as well.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any ideas on how to execute this?&lt;/P&gt;</description>
      <pubDate>Wed, 20 Apr 2016 21:54:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Complicated-merging-question/m-p/265249#M269275</guid>
      <dc:creator>epigrad123</dc:creator>
      <dc:date>2016-04-20T21:54:13Z</dc:date>
    </item>
    <item>
      <title>Re: Complicated merging question</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Complicated-merging-question/m-p/265256#M269276</link>
      <description>&lt;P&gt;This is likely going to be a job for Proc SQL in any form.&lt;/P&gt;
&lt;P&gt;If the variables you need to match on have the same names in both sets a NATURAL JOIN may work.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
   create table want as
   select setone.*, settwo.* 
   from setone natural join settwo;
quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;or use a specific join criteria&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
   create table want as
   select setone.*, settwo.* 
   from setone  join settwo
      on setone.id=settwo.id and setone.dob=settwo.dob 
         and setone.site=settwo.site and setone.visitdate=settwo.visitdate
quit; &lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 20 Apr 2016 22:12:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Complicated-merging-question/m-p/265256#M269276</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2016-04-20T22:12:50Z</dc:date>
    </item>
    <item>
      <title>Re: Complicated merging question</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Complicated-merging-question/m-p/265278#M269277</link>
      <description>&lt;P&gt;You'd better post some data and the output you want to see . Otherwise, we all just guessing what is your purpose.&lt;/P&gt;</description>
      <pubDate>Thu, 21 Apr 2016 01:29:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Complicated-merging-question/m-p/265278#M269277</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2016-04-21T01:29:47Z</dc:date>
    </item>
    <item>
      <title>Re: Complicated merging question</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Complicated-merging-question/m-p/265321#M269278</link>
      <description>&lt;P&gt;It sounds like fuzzy matching. Take a look at the link king software, and apparently they have the SAS code available as well.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 21 Apr 2016 05:53:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Complicated-merging-question/m-p/265321#M269278</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2016-04-21T05:53:00Z</dc:date>
    </item>
  </channel>
</rss>

