<?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: Joining in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Joining/m-p/350753#M81568</link>
    <description>&lt;P&gt;Hi&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Extending on &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/31304"&gt;@PeterClemmensen&lt;/a&gt; example you can combine the inA and inB variables so that you know the join type and do whatever you need.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data a;
input id name$;
datalines;
1 x
2 y
3 z
5 a
;

data b;
input id sal;
datalines;
2 100
4 400
5 500
;

proc sort data = a; by id; run;
proc sort data = b; by id; run;

/* Get non matches (id = 2 is the only match)*/
data fulljoin;
     merge a (in=ina) b (in=inb);
     by id;
     length joinType $ 2;
     joinType = cats(ina, inb);
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can also use SQL to create the join type varibale:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
  create table fullJoin_SQL as
  select
    coalesce(a.id, b.id) as id
    , name
    , sal
    , cats( missing(a.id) = 0, missing(b.id) = 0) as joinType length=2
  from
    a
    full outer join
    b
    on a.id = b.id
  ;
quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Bruno&lt;/P&gt;</description>
    <pubDate>Tue, 18 Apr 2017 08:58:35 GMT</pubDate>
    <dc:creator>BrunoMueller</dc:creator>
    <dc:date>2017-04-18T08:58:35Z</dc:date>
    <item>
      <title>Joining</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Joining/m-p/350742#M81560</link>
      <description>&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I need your help on one scenario based on merge two data sets.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Suppose I have two data sets where no of records present 50000 in first data set and 80000 records in second data set. I have to join the data sets by using keys &lt;STRONG&gt;Cust_No&lt;/STRONG&gt;,&lt;STRONG&gt;Mem_No&lt;/STRONG&gt; and &lt;STRONG&gt;Acct_No. &lt;/STRONG&gt;Once I use innre join I will get output of matched values..how will I get records which are not matching??&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please help me and let me knoq in case if you need any other information&lt;/P&gt;</description>
      <pubDate>Tue, 18 Apr 2017 08:17:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Joining/m-p/350742#M81560</guid>
      <dc:creator>rabishaw</dc:creator>
      <dc:date>2017-04-18T08:17:06Z</dc:date>
    </item>
    <item>
      <title>Re: Joining</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Joining/m-p/350745#M81562</link>
      <description>&lt;P&gt;I would try to be a bit clearer with your question. &amp;nbsp;If you have decided that inner join is right for your secnario, why are you now worried about those records which do not match? &amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;IMG src="https://communities.sas.com/t5/image/serverpage/image-id/8361iCF02BAF2909B10F7/image-size/original?v=1.0&amp;amp;px=-1" border="0" alt="Capture.PNG" title="Capture.PNG" /&gt;&lt;/P&gt;
&lt;P&gt;Above is a graphic which illustrates the various joins, choose one appropriate to your scenario.&lt;/P&gt;</description>
      <pubDate>Tue, 18 Apr 2017 08:26:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Joining/m-p/350745#M81562</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2017-04-18T08:26:59Z</dc:date>
    </item>
    <item>
      <title>Re: Joining</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Joining/m-p/350746#M81563</link>
      <description>&lt;P&gt;Thank you for your reply. My report needed unmatched records also for analysis purpose. Is there any other ways?? Please help me&lt;/P&gt;</description>
      <pubDate>Tue, 18 Apr 2017 08:29:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Joining/m-p/350746#M81563</guid>
      <dc:creator>rabishaw</dc:creator>
      <dc:date>2017-04-18T08:29:57Z</dc:date>
    </item>
    <item>
      <title>Re: Joining</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Joining/m-p/350748#M81564</link>
      <description>&lt;P&gt;This small example should get you going&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data a;
input id name$;
datalines;
1 x
2 y
3 z
;

data b;
input id sal;
datalines;
2 100
4 400
5 500
;

proc sort data = a; by id; run;
proc sort data = b; by id; run;

/* Get non matches (id = 2 is the only match)*/
data nonMatch;
     merge a (in=ina) b (in=inb);
     by id;
     if not ina or not inb;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 18 Apr 2017 08:38:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Joining/m-p/350748#M81564</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2017-04-18T08:38:46Z</dc:date>
    </item>
    <item>
      <title>Re: Joining</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Joining/m-p/350752#M81567</link>
      <description>&lt;P&gt;Sorry, your still not explaining what the issue is. &amp;nbsp;The graphic I provided gives you a visual representation of how to get various types of data out from joining, you just select which one meets your needs and use that. &amp;nbsp;From what you have said its likely that outer join is what you want.&lt;/P&gt;</description>
      <pubDate>Tue, 18 Apr 2017 08:56:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Joining/m-p/350752#M81567</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2017-04-18T08:56:50Z</dc:date>
    </item>
    <item>
      <title>Re: Joining</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Joining/m-p/350753#M81568</link>
      <description>&lt;P&gt;Hi&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Extending on &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/31304"&gt;@PeterClemmensen&lt;/a&gt; example you can combine the inA and inB variables so that you know the join type and do whatever you need.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data a;
input id name$;
datalines;
1 x
2 y
3 z
5 a
;

data b;
input id sal;
datalines;
2 100
4 400
5 500
;

proc sort data = a; by id; run;
proc sort data = b; by id; run;

/* Get non matches (id = 2 is the only match)*/
data fulljoin;
     merge a (in=ina) b (in=inb);
     by id;
     length joinType $ 2;
     joinType = cats(ina, inb);
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can also use SQL to create the join type varibale:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
  create table fullJoin_SQL as
  select
    coalesce(a.id, b.id) as id
    , name
    , sal
    , cats( missing(a.id) = 0, missing(b.id) = 0) as joinType length=2
  from
    a
    full outer join
    b
    on a.id = b.id
  ;
quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Bruno&lt;/P&gt;</description>
      <pubDate>Tue, 18 Apr 2017 08:58:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Joining/m-p/350753#M81568</guid>
      <dc:creator>BrunoMueller</dc:creator>
      <dc:date>2017-04-18T08:58:35Z</dc:date>
    </item>
    <item>
      <title>Re: Joining</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Joining/m-p/350754#M81569</link>
      <description>Thank you for your reply. I will try the way mention.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Tue, 18 Apr 2017 08:59:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Joining/m-p/350754#M81569</guid>
      <dc:creator>rabishaw</dc:creator>
      <dc:date>2017-04-18T08:59:16Z</dc:date>
    </item>
  </channel>
</rss>

