<?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 Many-to-Many Datasets in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Merging-Many-to-Many-Datasets/m-p/23768#M5304</link>
    <description>proc sql;&lt;BR /&gt;
create table manytomany as&lt;BR /&gt;
   select b.*, a.VarB&lt;BR /&gt;
      from secondset b, firstset a&lt;BR /&gt;
    where b.VarA=a.VarA;</description>
    <pubDate>Fri, 06 Jun 2008 06:05:44 GMT</pubDate>
    <dc:creator>deleted_user</dc:creator>
    <dc:date>2008-06-06T06:05:44Z</dc:date>
    <item>
      <title>Merging Many-to-Many Datasets</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Merging-Many-to-Many-Datasets/m-p/23767#M5303</link>
      <description>Hi, &lt;BR /&gt;
&lt;BR /&gt;
I have done one-to-one and one-to-many match merge using SAS. However, I'm having trouble doing a many-to-many match merge. I hope someone can help me. For simplicity, assume that I have the following datasets:&lt;BR /&gt;
&lt;BR /&gt;
First datasets:&lt;BR /&gt;
VarA VarB&lt;BR /&gt;
a1     a&lt;BR /&gt;
a1     b&lt;BR /&gt;
a1     c&lt;BR /&gt;
a2     a&lt;BR /&gt;
a2     d&lt;BR /&gt;
a3     b&lt;BR /&gt;
a3     f&lt;BR /&gt;
&lt;BR /&gt;
Second datasets:&lt;BR /&gt;
VarC VarA&lt;BR /&gt;
c1     a1&lt;BR /&gt;
c1     a2&lt;BR /&gt;
c2     a1&lt;BR /&gt;
c2     a3&lt;BR /&gt;
c3     a1&lt;BR /&gt;
&lt;BR /&gt;
Is there any way for me to merge the two datasets so that I will have the following:&lt;BR /&gt;
VarC VarA VarB&lt;BR /&gt;
c1     a1     a&lt;BR /&gt;
c1     a1     b&lt;BR /&gt;
c1     a1     c&lt;BR /&gt;
c1     a2     a&lt;BR /&gt;
c1     a2     d&lt;BR /&gt;
c2     a1     a&lt;BR /&gt;
c2     a1     b&lt;BR /&gt;
c2     a1     c&lt;BR /&gt;
c2     a3     b&lt;BR /&gt;
c2     a3     f&lt;BR /&gt;
c3     a1     a&lt;BR /&gt;
c3     a1     b&lt;BR /&gt;
c3     a1     c&lt;BR /&gt;
&lt;BR /&gt;
I sorted both datasets by VarA and then merged the datasets by VarA but the results are not what I wanted. I think the above can be done as there is a logical sequence to the matching but I can't seem to do it. Can someone please help? Thanks!</description>
      <pubDate>Fri, 06 Jun 2008 04:29:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Merging-Many-to-Many-Datasets/m-p/23767#M5303</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2008-06-06T04:29:26Z</dc:date>
    </item>
    <item>
      <title>Re: Merging Many-to-Many Datasets</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Merging-Many-to-Many-Datasets/m-p/23768#M5304</link>
      <description>proc sql;&lt;BR /&gt;
create table manytomany as&lt;BR /&gt;
   select b.*, a.VarB&lt;BR /&gt;
      from secondset b, firstset a&lt;BR /&gt;
    where b.VarA=a.VarA;</description>
      <pubDate>Fri, 06 Jun 2008 06:05:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Merging-Many-to-Many-Datasets/m-p/23768#M5304</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2008-06-06T06:05:44Z</dc:date>
    </item>
    <item>
      <title>Re: Merging Many-to-Many Datasets</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Merging-Many-to-Many-Datasets/m-p/23769#M5305</link>
      <description>Hi Vasile,&lt;BR /&gt;
&lt;BR /&gt;
Thank you so much! I used your proc sql statement and got the dataset that I required. Cheers!</description>
      <pubDate>Tue, 10 Jun 2008 07:06:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Merging-Many-to-Many-Datasets/m-p/23769#M5305</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2008-06-10T07:06:08Z</dc:date>
    </item>
  </channel>
</rss>

