<?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 merging two datasets with uncommon variables in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/merging-two-datasets-with-uncommon-variables/m-p/65316#M18632</link>
    <description>I am trying to merge table 1 with table 2; however, table 1 has a visit # field and lab date fields, while table 2 only has an event date field. I want the merged table to show all labs that have a specific value at a certain visit and also include any corresponding events that happen on that same day or close to that date. The problem is an event date might be different than a lab date. Currently my table looks like this:&lt;BR /&gt;
&lt;BR /&gt;
VISNO         LAB             EVENT&lt;BR /&gt;
00               aa, bb           xxxxxxxx&lt;BR /&gt;
01               aa, ab           xxxxxxxx&lt;BR /&gt;
&lt;BR /&gt;
Because I can't merge by a common variable other that patient ID, the EVENT field repeats whenever there is more than one lab record. What I really want the table to look like is this:&lt;BR /&gt;
&lt;BR /&gt;
VISNO         LAB             EVENT&lt;BR /&gt;
00               aa, bb           xxxxxxxx&lt;BR /&gt;
01               aa, ab           &lt;BR /&gt;
&lt;BR /&gt;
Is there anyway to keep the events from repeating whenever there are multiple lab records?&lt;BR /&gt;
&lt;BR /&gt;
Thanks.</description>
    <pubDate>Thu, 12 May 2011 15:11:56 GMT</pubDate>
    <dc:creator>lnb001</dc:creator>
    <dc:date>2011-05-12T15:11:56Z</dc:date>
    <item>
      <title>merging two datasets with uncommon variables</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/merging-two-datasets-with-uncommon-variables/m-p/65316#M18632</link>
      <description>I am trying to merge table 1 with table 2; however, table 1 has a visit # field and lab date fields, while table 2 only has an event date field. I want the merged table to show all labs that have a specific value at a certain visit and also include any corresponding events that happen on that same day or close to that date. The problem is an event date might be different than a lab date. Currently my table looks like this:&lt;BR /&gt;
&lt;BR /&gt;
VISNO         LAB             EVENT&lt;BR /&gt;
00               aa, bb           xxxxxxxx&lt;BR /&gt;
01               aa, ab           xxxxxxxx&lt;BR /&gt;
&lt;BR /&gt;
Because I can't merge by a common variable other that patient ID, the EVENT field repeats whenever there is more than one lab record. What I really want the table to look like is this:&lt;BR /&gt;
&lt;BR /&gt;
VISNO         LAB             EVENT&lt;BR /&gt;
00               aa, bb           xxxxxxxx&lt;BR /&gt;
01               aa, ab           &lt;BR /&gt;
&lt;BR /&gt;
Is there anyway to keep the events from repeating whenever there are multiple lab records?&lt;BR /&gt;
&lt;BR /&gt;
Thanks.</description>
      <pubDate>Thu, 12 May 2011 15:11:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/merging-two-datasets-with-uncommon-variables/m-p/65316#M18632</guid>
      <dc:creator>lnb001</dc:creator>
      <dc:date>2011-05-12T15:11:56Z</dc:date>
    </item>
    <item>
      <title>Re: merging two datasets with uncommon variables</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/merging-two-datasets-with-uncommon-variables/m-p/65317#M18633</link>
      <description>It would be helpful that you need to post some dummy data and what you want your output to look like. It is hard to guess your intention.&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
Ksharp</description>
      <pubDate>Fri, 13 May 2011 09:41:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/merging-two-datasets-with-uncommon-variables/m-p/65317#M18633</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2011-05-13T09:41:49Z</dc:date>
    </item>
    <item>
      <title>Re: merging two datasets with uncommon variables</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/merging-two-datasets-with-uncommon-variables/m-p/65318#M18634</link>
      <description>I agree with KSharp, the narrative and the examples are confusing.  Particularly as the narrative seems to be missing variables and you have 3 heading and 4 pieces of data in the sample.&lt;BR /&gt;
&lt;BR /&gt;
Reading between the lines, I generally attack this sort of problem with PROC SQL.  The idea of a "fuzzy" match or "nearest" match on dates is a natural for the BETWEEN operator on a JOIN.  There are good examples of this in the SQL reference manual as well as in several BBUs.&lt;BR /&gt;
&lt;BR /&gt;
Doc Muhlbaier&lt;BR /&gt;
Duke</description>
      <pubDate>Fri, 13 May 2011 17:58:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/merging-two-datasets-with-uncommon-variables/m-p/65318#M18634</guid>
      <dc:creator>Doc_Duke</dc:creator>
      <dc:date>2011-05-13T17:58:57Z</dc:date>
    </item>
  </channel>
</rss>

