<?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: WHAT KIND OF JOIN in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/WHAT-KIND-OF-JOIN/m-p/880130#M347751</link>
    <description>&lt;P&gt;it is full join?&lt;/P&gt;</description>
    <pubDate>Mon, 12 Jun 2023 06:22:23 GMT</pubDate>
    <dc:creator>HeatherNewton</dc:creator>
    <dc:date>2023-06-12T06:22:23Z</dc:date>
    <item>
      <title>WHAT KIND OF JOIN</title>
      <link>https://communities.sas.com/t5/SAS-Programming/WHAT-KIND-OF-JOIN/m-p/880129#M347750</link>
      <description>&lt;PRE&gt;data long;
merge long pd_score;
by segment date;
run;
&lt;/PRE&gt;
&lt;P&gt;how do I know what kind of join is this? assume join?&lt;/P&gt;</description>
      <pubDate>Mon, 12 Jun 2023 06:16:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/WHAT-KIND-OF-JOIN/m-p/880129#M347750</guid>
      <dc:creator>HeatherNewton</dc:creator>
      <dc:date>2023-06-12T06:16:11Z</dc:date>
    </item>
    <item>
      <title>Re: WHAT KIND OF JOIN</title>
      <link>https://communities.sas.com/t5/SAS-Programming/WHAT-KIND-OF-JOIN/m-p/880130#M347751</link>
      <description>&lt;P&gt;it is full join?&lt;/P&gt;</description>
      <pubDate>Mon, 12 Jun 2023 06:22:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/WHAT-KIND-OF-JOIN/m-p/880130#M347751</guid>
      <dc:creator>HeatherNewton</dc:creator>
      <dc:date>2023-06-12T06:22:23Z</dc:date>
    </item>
    <item>
      <title>Re: WHAT KIND OF JOIN</title>
      <link>https://communities.sas.com/t5/SAS-Programming/WHAT-KIND-OF-JOIN/m-p/880131#M347752</link>
      <description>&lt;P&gt;does it depends on columns?&lt;/P&gt;
&lt;P&gt;let say long has 10 columns (including segment, date and pd)&lt;/P&gt;
&lt;P&gt;pd_score only 3 where two are used for joining (segment, date, pd)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;now segment and date are used for joining&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;what can we say what kind of join this is?&lt;/P&gt;
&lt;P&gt;full join? left join?&lt;/P&gt;</description>
      <pubDate>Mon, 12 Jun 2023 06:32:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/WHAT-KIND-OF-JOIN/m-p/880131#M347752</guid>
      <dc:creator>HeatherNewton</dc:creator>
      <dc:date>2023-06-12T06:32:55Z</dc:date>
    </item>
    <item>
      <title>Re: WHAT KIND OF JOIN</title>
      <link>https://communities.sas.com/t5/SAS-Programming/WHAT-KIND-OF-JOIN/m-p/880135#M347754</link>
      <description>&lt;P&gt;First of all, it's not a JOIN, it's a MERGE.&lt;/P&gt;
&lt;P&gt;The differences between a data step MERGE and a SQL JOIN are significant.&lt;/P&gt;
&lt;P&gt;Maxim 3: Know Your Data.&lt;/P&gt;
&lt;P&gt;What is the relationship with regard of the BY variables? 1:n, n:1, m:n, or n:n?&lt;/P&gt;
&lt;P&gt;This will determine the number of observations in the result.&lt;/P&gt;
&lt;P&gt;Are there any variables in both datasets besides the BY variables?&lt;/P&gt;
&lt;P&gt;If yes, the sequence of reading the observations ("left" or "right") into the PDV will determine which values make it into the result.&lt;/P&gt;
&lt;P&gt;Also apply Maxim 4.&lt;/P&gt;</description>
      <pubDate>Mon, 12 Jun 2023 07:17:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/WHAT-KIND-OF-JOIN/m-p/880135#M347754</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2023-06-12T07:17:17Z</dc:date>
    </item>
    <item>
      <title>Re: WHAT KIND OF JOIN</title>
      <link>https://communities.sas.com/t5/SAS-Programming/WHAT-KIND-OF-JOIN/m-p/880164#M347770</link>
      <description>&lt;P&gt;In other words than &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/11562"&gt;@Kurt_Bremser&lt;/a&gt; - it is &lt;U&gt;&lt;EM&gt;similar&lt;/EM&gt; &lt;/U&gt;to full join.&lt;/P&gt;
&lt;P&gt;The biggest difference between data step and SQL is that the data step goes row-by-row for all data sets in the merge.&lt;/P&gt;
&lt;P&gt;This means it doesn't create a Cartesian product in case of a M-M relationship between the data sets. This will make the data step&amp;nbsp; merge return fewer rows compared to a SQL join.&lt;/P&gt;</description>
      <pubDate>Mon, 12 Jun 2023 11:13:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/WHAT-KIND-OF-JOIN/m-p/880164#M347770</guid>
      <dc:creator>LinusH</dc:creator>
      <dc:date>2023-06-12T11:13:55Z</dc:date>
    </item>
    <item>
      <title>Re: WHAT KIND OF JOIN</title>
      <link>https://communities.sas.com/t5/SAS-Programming/WHAT-KIND-OF-JOIN/m-p/880262#M347802</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/416388"&gt;@HeatherNewton&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;PRE&gt;data long;
merge long pd_score;
by segment date;
run;
&lt;/PRE&gt;
&lt;P&gt;how do I know what kind of join is this? assume join?&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Are values of the segment date combinations duplicated in either data set? Then almost certainly not a "join" of any type as the MERGE behave quite differently when By variables are duplicated in both sets.&lt;/P&gt;
&lt;P&gt;Are there variables in the data sets that have common names other than the BY variables? Then almost certainly not a join as only one value is kept and would be from the right-most data set on the Merge statement which is quite different than a Join where you either must specify&amp;nbsp; which version to keep OR if using the * with both source tables would likely keep the first defined alias values.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The behavior of MERGE when BY variables do not match is quite different than a right, left or just about any "Join on" condition.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Merge may also behave a bit differently than SQL when variables are of different lengths with common names.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So IF you are trying to translate a Merge to an SQL join then example data and expected result should be provided. And the example data better be pretty descriptive of your actual data because a small example that doesn't include duplicates but your real problem does will likely not behave as expected.&lt;/P&gt;</description>
      <pubDate>Mon, 12 Jun 2023 17:40:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/WHAT-KIND-OF-JOIN/m-p/880262#M347802</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2023-06-12T17:40:47Z</dc:date>
    </item>
    <item>
      <title>Re: WHAT KIND OF JOIN</title>
      <link>https://communities.sas.com/t5/SAS-Programming/WHAT-KIND-OF-JOIN/m-p/880265#M347803</link>
      <description>I'll direct you back to your previous thread. The answers has not changed.&lt;BR /&gt;&lt;BR /&gt;&lt;A href="https://communities.sas.com/t5/SAS-Programming/SAS-merge-SQL-equivalent/td-p/798286" target="_blank"&gt;https://communities.sas.com/t5/SAS-Programming/SAS-merge-SQL-equivalent/td-p/798286&lt;/A&gt;</description>
      <pubDate>Mon, 12 Jun 2023 17:55:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/WHAT-KIND-OF-JOIN/m-p/880265#M347803</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2023-06-12T17:55:50Z</dc:date>
    </item>
  </channel>
</rss>

