<?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 Many to many merge in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Many-to-many-merge/m-p/797709#M313633</link>
    <description>&lt;P&gt;Hello&lt;/P&gt;
&lt;P&gt;Here is many to mane merge .&lt;/P&gt;
&lt;P&gt;I need to get 9 rows but I get 5&lt;/P&gt;
&lt;P&gt;How can I get the desired result please?&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;Data have1;
input AccountID trasactionKey;
cards;
123 222777
123 999999
456 333888
;
Run;


 Data have2;
 Input AccountID customerID;
 cards;
123 999
123 888
123 333 
123 222
456 333
;
Run;

Data wanted;
input AccountID trasactionKey customerID;
cards;
123 222777 999
123 222777 888
123 222777 333
123 222777 222
123 999999 999
123 999999 888
123 999999 333
123 999999 222
456 333888 333
;
Run;


proc sort data=have1;
by AccountID;
Run;

proc sort data=have2;
by AccountID;
Run;


Data My_Try_to_get_wanted;
merge have1(in=a) have2(in=b);
by AccountID;
if a;
Run;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Tue, 22 Feb 2022 05:55:17 GMT</pubDate>
    <dc:creator>Ronein</dc:creator>
    <dc:date>2022-02-22T05:55:17Z</dc:date>
    <item>
      <title>Many to many merge</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Many-to-many-merge/m-p/797709#M313633</link>
      <description>&lt;P&gt;Hello&lt;/P&gt;
&lt;P&gt;Here is many to mane merge .&lt;/P&gt;
&lt;P&gt;I need to get 9 rows but I get 5&lt;/P&gt;
&lt;P&gt;How can I get the desired result please?&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;Data have1;
input AccountID trasactionKey;
cards;
123 222777
123 999999
456 333888
;
Run;


 Data have2;
 Input AccountID customerID;
 cards;
123 999
123 888
123 333 
123 222
456 333
;
Run;

Data wanted;
input AccountID trasactionKey customerID;
cards;
123 222777 999
123 222777 888
123 222777 333
123 222777 222
123 999999 999
123 999999 888
123 999999 333
123 999999 222
456 333888 333
;
Run;


proc sort data=have1;
by AccountID;
Run;

proc sort data=have2;
by AccountID;
Run;


Data My_Try_to_get_wanted;
merge have1(in=a) have2(in=b);
by AccountID;
if a;
Run;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 22 Feb 2022 05:55:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Many-to-many-merge/m-p/797709#M313633</guid>
      <dc:creator>Ronein</dc:creator>
      <dc:date>2022-02-22T05:55:17Z</dc:date>
    </item>
    <item>
      <title>Re: Many to many merge</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Many-to-many-merge/m-p/797711#M313635</link>
      <description>&lt;P&gt;Please have a look at the documentation of the merge statement, there you will find an explanation.&lt;/P&gt;</description>
      <pubDate>Tue, 22 Feb 2022 06:38:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Many-to-many-merge/m-p/797711#M313635</guid>
      <dc:creator>andreas_lds</dc:creator>
      <dc:date>2022-02-22T06:38:49Z</dc:date>
    </item>
    <item>
      <title>Re: Many to many merge</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Many-to-many-merge/m-p/797717#M313641</link>
      <description>&lt;P&gt;9 observations points to a cartesian join, for which you need PROC SQL.&lt;/P&gt;</description>
      <pubDate>Tue, 22 Feb 2022 07:07:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Many-to-many-merge/m-p/797717#M313641</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2022-02-22T07:07:13Z</dc:date>
    </item>
    <item>
      <title>Re: Many to many merge</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Many-to-many-merge/m-p/797734#M313647</link>
      <description>&lt;PRE&gt;Data have1;
input AccountID trasactionKey;
cards;
123 222777
123 999999
456 333888
;
Run;


 Data have2;
 Input AccountID customerID;
 cards;
123 999
123 888
123 333 
123 222
456 333
;
Run;
&lt;BR /&gt;/****   sql full join ****/&lt;BR /&gt;
proc sql; 
 create table Want as
  select * 
   from have1 full join have2
   on have1.AccountID=have2.AccountID;
quit;

&lt;/PRE&gt;</description>
      <pubDate>Tue, 22 Feb 2022 09:04:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Many-to-many-merge/m-p/797734#M313647</guid>
      <dc:creator>AndreaVianello</dc:creator>
      <dc:date>2022-02-22T09:04:35Z</dc:date>
    </item>
  </channel>
</rss>

