<?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: Merge in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Merge-with-same-named-columns/m-p/911974#M359567</link>
    <description>&lt;P&gt;This is a good experiment to work through with example data.&amp;nbsp; After doing it with a one-to-one merge, and noting the results, you might also try it with a one-to-many merge, and note how the results are different.&amp;nbsp; To really understand MERGE, and how it handles these types of variable collisions, you need to think in terms of the program data vector.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also, if you set system option MSGLEVEL=i , you will get an INFO: message in the log warning you when a collision happens, but the message itself is a bit misleading as to the complexity of the results from a collision.&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 18 Jan 2024 14:49:20 GMT</pubDate>
    <dc:creator>Quentin</dc:creator>
    <dc:date>2024-01-18T14:49:20Z</dc:date>
    <item>
      <title>Merge with same named columns</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Merge-with-same-named-columns/m-p/911951#M359561</link>
      <description>&lt;P&gt;If i merge tableA and tableB by account &lt;BR /&gt;Let say apart from column account, both table A and table B both have columns salary and age. For the same account in tableA and tableB, salary of table A is different from salary of table B, age of tableA is different from tableB, after merging what would happen? Which salary and age will be in the resulting row?&lt;/P&gt;</description>
      <pubDate>Fri, 19 Jan 2024 07:53:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Merge-with-same-named-columns/m-p/911951#M359561</guid>
      <dc:creator>HeatherNewton</dc:creator>
      <dc:date>2024-01-19T07:53:29Z</dc:date>
    </item>
    <item>
      <title>Re: Merge</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Merge-with-same-named-columns/m-p/911955#M359563</link>
      <description>&lt;P&gt;TableB columns will overwrite TableA columns with the same name.&lt;/P&gt;
&lt;P&gt;Unless this is what you want, avoid this situation, e.g., by using the rename= data set option on one or more input data sets.&lt;/P&gt;</description>
      <pubDate>Thu, 18 Jan 2024 11:56:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Merge-with-same-named-columns/m-p/911955#M359563</guid>
      <dc:creator>LinusH</dc:creator>
      <dc:date>2024-01-18T11:56:25Z</dc:date>
    </item>
    <item>
      <title>Re: Merge</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Merge-with-same-named-columns/m-p/911974#M359567</link>
      <description>&lt;P&gt;This is a good experiment to work through with example data.&amp;nbsp; After doing it with a one-to-one merge, and noting the results, you might also try it with a one-to-many merge, and note how the results are different.&amp;nbsp; To really understand MERGE, and how it handles these types of variable collisions, you need to think in terms of the program data vector.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also, if you set system option MSGLEVEL=i , you will get an INFO: message in the log warning you when a collision happens, but the message itself is a bit misleading as to the complexity of the results from a collision.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 18 Jan 2024 14:49:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Merge-with-same-named-columns/m-p/911974#M359567</guid>
      <dc:creator>Quentin</dc:creator>
      <dc:date>2024-01-18T14:49:20Z</dc:date>
    </item>
    <item>
      <title>Re: Merge</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Merge-with-same-named-columns/m-p/912028#M359589</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;BR /&gt;Which salary and age will be in the resulting row?&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;It depends.&lt;/P&gt;
&lt;P&gt;In a one-to-one&amp;nbsp; and a one-to-many MERGE, the values of the "right" dataset will overwrite those of the "left".&lt;/P&gt;
&lt;P&gt;In a many-to-one MERGE, in the first observation of a group the same as above will happen, but in the following observations, the "left" dataset will win.&lt;/P&gt;
&lt;P&gt;In a many-to-many MERGE, the behavior depends on which dataset runs out of observations first.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Bottom line: don't do this without additional code that forces which values will end up in the result, so the intention of the programmer becomes clear.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 18 Jan 2024 21:48:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Merge-with-same-named-columns/m-p/912028#M359589</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2024-01-18T21:48:02Z</dc:date>
    </item>
  </channel>
</rss>

