<?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: PROC SQL lef join not joining correctly in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/PROC-SQL-lef-join-not-joining-correctly/m-p/890431#M351844</link>
    <description>&lt;P&gt;That is the basic behavior of a left join: ALL of the records in the "left" set are joined to ALL of the records that match in the "right" set.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Perhaps you need to join on two or more variables such as &lt;/P&gt;
&lt;PRE&gt;proc sql; 
   create table eligs as 
   select  a. * ,
   b. x_dupIPelig label = "Match with other Elig" as eligIP_flag

   from eligIP2 a 
            left join 
            eligIPdups b
    on a.screener_ID = b.screener_ID
        and a.vidnum=b.vidnum
   ;
quit;&lt;/PRE&gt;</description>
    <pubDate>Tue, 22 Aug 2023 16:29:35 GMT</pubDate>
    <dc:creator>ballardw</dc:creator>
    <dc:date>2023-08-22T16:29:35Z</dc:date>
    <item>
      <title>PROC SQL lef join not joining correctly</title>
      <link>https://communities.sas.com/t5/SAS-Programming/PROC-SQL-lef-join-not-joining-correctly/m-p/890429#M351842</link>
      <description>&lt;P&gt;Hi all,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'm having some issues with the below code and datasets. I am trying to use a proc sql left join to bring the two datasets together with a new variable, but when I do it adds an extra two from the second dataset instead of only joining to the two already existing in the first dataset. Code and pictures of the three datasets in order below. Thank you in advance for the help!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;proc sql; create table eligs as select&lt;BR /&gt;a. * ,&lt;BR /&gt;b. x_dupIPelig label = "Match with other Elig" as eligIP_flag&lt;/P&gt;
&lt;P&gt;from eligIP2 a left join eligIPdups b&lt;BR /&gt;on a.screener_ID = b.screener_ID;&lt;BR /&gt;quit;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;eligIP2:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Corinthian94_0-1692720733110.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/86911i7328AEBE8ED6E8D1/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Corinthian94_0-1692720733110.png" alt="Corinthian94_0-1692720733110.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;Eligipdups:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Corinthian94_1-1692720785621.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/86912iF14A08851959F297/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Corinthian94_1-1692720785621.png" alt="Corinthian94_1-1692720785621.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Eligs(Created dataset):&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Corinthian94_2-1692720841076.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/86913i0F0E91EE331E0063/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Corinthian94_2-1692720841076.png" alt="Corinthian94_2-1692720841076.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 22 Aug 2023 16:14:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/PROC-SQL-lef-join-not-joining-correctly/m-p/890429#M351842</guid>
      <dc:creator>Corinthian94</dc:creator>
      <dc:date>2023-08-22T16:14:38Z</dc:date>
    </item>
    <item>
      <title>Re: PROC SQL lef join not joining correctly</title>
      <link>https://communities.sas.com/t5/SAS-Programming/PROC-SQL-lef-join-not-joining-correctly/m-p/890431#M351844</link>
      <description>&lt;P&gt;That is the basic behavior of a left join: ALL of the records in the "left" set are joined to ALL of the records that match in the "right" set.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Perhaps you need to join on two or more variables such as &lt;/P&gt;
&lt;PRE&gt;proc sql; 
   create table eligs as 
   select  a. * ,
   b. x_dupIPelig label = "Match with other Elig" as eligIP_flag

   from eligIP2 a 
            left join 
            eligIPdups b
    on a.screener_ID = b.screener_ID
        and a.vidnum=b.vidnum
   ;
quit;&lt;/PRE&gt;</description>
      <pubDate>Tue, 22 Aug 2023 16:29:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/PROC-SQL-lef-join-not-joining-correctly/m-p/890431#M351844</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2023-08-22T16:29:35Z</dc:date>
    </item>
  </channel>
</rss>

