<?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 issue for many to one in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Merge-issue-for-many-to-one/m-p/277991#M55896</link>
    <description>&lt;P&gt;I'm assuming you actually used semicolons to end your statements, and you merged using a MERGE statement rather than a SET statement.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The basic problem is that you have a common variable, SUBJECT, in both data sets.&amp;nbsp; There are a couple of ways to deal with that.&amp;nbsp; To ignore all SUBJECT values in one data set, you could just drop it:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data final;&lt;/P&gt;
&lt;P&gt;merge new (drop=subject in=a) new1;&lt;/P&gt;
&lt;P&gt;by name class;&lt;/P&gt;
&lt;P&gt;if a;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I would assume you are merging by both variables, and not just by NAME.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The problem gets a little more complex if you need to compare the SUBJECT values in the two data sets, to see which you want to use.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Good luck.&lt;/P&gt;</description>
    <pubDate>Thu, 16 Jun 2016 18:06:21 GMT</pubDate>
    <dc:creator>Astounding</dc:creator>
    <dc:date>2016-06-16T18:06:21Z</dc:date>
    <item>
      <title>Merge issue for many to one</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Merge-issue-for-many-to-one/m-p/277976#M55889</link>
      <description>Hello All,&lt;BR /&gt;&lt;BR /&gt;I have two dataset with same variables&lt;BR /&gt;Name class subject&lt;BR /&gt;Cc class2 a2&lt;BR /&gt;Dd class1&lt;BR /&gt;Dd class1&lt;BR /&gt;Dd class1&lt;BR /&gt;≠==============&lt;BR /&gt;Second dataset&lt;BR /&gt;Name class subject&lt;BR /&gt;Dd class1 d1&lt;BR /&gt;Cc class2 c2&lt;BR /&gt;&lt;BR /&gt;===========&lt;BR /&gt;After sorting by name and class for both dataset&lt;BR /&gt;Using below syntax&lt;BR /&gt;Data final&lt;BR /&gt;Set new (in=a) new1&lt;BR /&gt;By name&lt;BR /&gt;If a&lt;BR /&gt;&lt;BR /&gt;=======&lt;BR /&gt;I am getting&lt;BR /&gt;Cc class2 c2&lt;BR /&gt;Dd class1 d1&lt;BR /&gt;Dd class1&lt;BR /&gt;Dd class1&lt;BR /&gt;===============&lt;BR /&gt;However I require like&lt;BR /&gt;&lt;BR /&gt;Cc class2 c2&lt;BR /&gt;Dd class1 d1&lt;BR /&gt;Dd class1 d1&lt;BR /&gt;Dd class1 d1&lt;BR /&gt;&lt;BR /&gt;Please suggest and thanks&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Thu, 16 Jun 2016 17:31:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Merge-issue-for-many-to-one/m-p/277976#M55889</guid>
      <dc:creator>Dd07</dc:creator>
      <dc:date>2016-06-16T17:31:45Z</dc:date>
    </item>
    <item>
      <title>Re: Merge issue for many to one</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Merge-issue-for-many-to-one/m-p/277991#M55896</link>
      <description>&lt;P&gt;I'm assuming you actually used semicolons to end your statements, and you merged using a MERGE statement rather than a SET statement.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The basic problem is that you have a common variable, SUBJECT, in both data sets.&amp;nbsp; There are a couple of ways to deal with that.&amp;nbsp; To ignore all SUBJECT values in one data set, you could just drop it:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data final;&lt;/P&gt;
&lt;P&gt;merge new (drop=subject in=a) new1;&lt;/P&gt;
&lt;P&gt;by name class;&lt;/P&gt;
&lt;P&gt;if a;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I would assume you are merging by both variables, and not just by NAME.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The problem gets a little more complex if you need to compare the SUBJECT values in the two data sets, to see which you want to use.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Good luck.&lt;/P&gt;</description>
      <pubDate>Thu, 16 Jun 2016 18:06:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Merge-issue-for-many-to-one/m-p/277991#M55896</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2016-06-16T18:06:21Z</dc:date>
    </item>
  </channel>
</rss>

