<?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 Merge and By Variable Issue in SAS Enterprise Guide</title>
    <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Merge-and-By-Variable-Issue/m-p/297381#M20265</link>
    <description>&lt;P&gt;Hello Team,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am dealing with multiple datasets in one of my program, Recently I added one dataset which dont have column used in merge operation earlier. So I added empty column as below&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc sql;&lt;BR /&gt;create table Emfuleni.GroupCodeTemp as&lt;BR /&gt;select '' AS Ward_Description, wGroup, szAccountNumber&lt;BR /&gt;from db.GroupChange&lt;BR /&gt;WHERE wClientCode = -10023 ORDER BY szAccountNumber;&lt;BR /&gt;quit;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;DATA GroupCode;&lt;BR /&gt;SET Emfuleni.GroupCodeTemp;&lt;BR /&gt;BY szAccountNumber;&lt;BR /&gt;IF FIRST.szAccountNumber THEN count=1;&lt;BR /&gt;else count+1;&lt;BR /&gt;IF count&amp;gt;2 THEN delete;&lt;BR /&gt;drop count;&lt;BR /&gt;RUN;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In above query Ward_Description is empty column added. Now I am using this dataset in one of merge operation as below&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data Emfuleni.lastjoin;&lt;BR /&gt;merge Emfuleni.ptp Emfuleni.masterward(in = a where = (open eq 1)) &lt;SPAN&gt;Emfuleni.Arrears&amp;nbsp;&lt;/SPAN&gt;Emfuleni.groupcode ;&lt;BR /&gt;by Ward_Description szAccountNumber;&lt;BR /&gt;if a;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But i am always getting error as below&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;ERROR: BY variable Ward_Description is not on input data set EMFULENI.GROUPCODE.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can someone please assist me what going wrong here ?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks In Advance&lt;/P&gt;</description>
    <pubDate>Fri, 09 Sep 2016 12:59:48 GMT</pubDate>
    <dc:creator>yudhishtirb</dc:creator>
    <dc:date>2016-09-09T12:59:48Z</dc:date>
    <item>
      <title>Merge and By Variable Issue</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Merge-and-By-Variable-Issue/m-p/297381#M20265</link>
      <description>&lt;P&gt;Hello Team,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am dealing with multiple datasets in one of my program, Recently I added one dataset which dont have column used in merge operation earlier. So I added empty column as below&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc sql;&lt;BR /&gt;create table Emfuleni.GroupCodeTemp as&lt;BR /&gt;select '' AS Ward_Description, wGroup, szAccountNumber&lt;BR /&gt;from db.GroupChange&lt;BR /&gt;WHERE wClientCode = -10023 ORDER BY szAccountNumber;&lt;BR /&gt;quit;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;DATA GroupCode;&lt;BR /&gt;SET Emfuleni.GroupCodeTemp;&lt;BR /&gt;BY szAccountNumber;&lt;BR /&gt;IF FIRST.szAccountNumber THEN count=1;&lt;BR /&gt;else count+1;&lt;BR /&gt;IF count&amp;gt;2 THEN delete;&lt;BR /&gt;drop count;&lt;BR /&gt;RUN;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In above query Ward_Description is empty column added. Now I am using this dataset in one of merge operation as below&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data Emfuleni.lastjoin;&lt;BR /&gt;merge Emfuleni.ptp Emfuleni.masterward(in = a where = (open eq 1)) &lt;SPAN&gt;Emfuleni.Arrears&amp;nbsp;&lt;/SPAN&gt;Emfuleni.groupcode ;&lt;BR /&gt;by Ward_Description szAccountNumber;&lt;BR /&gt;if a;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But i am always getting error as below&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;ERROR: BY variable Ward_Description is not on input data set EMFULENI.GROUPCODE.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can someone please assist me what going wrong here ?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks In Advance&lt;/P&gt;</description>
      <pubDate>Fri, 09 Sep 2016 12:59:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Merge-and-By-Variable-Issue/m-p/297381#M20265</guid>
      <dc:creator>yudhishtirb</dc:creator>
      <dc:date>2016-09-09T12:59:48Z</dc:date>
    </item>
    <item>
      <title>Re: Merge and By Variable Issue</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Merge-and-By-Variable-Issue/m-p/297410#M20266</link>
      <description>&lt;P&gt;Since you are using this code:&lt;/P&gt;
&lt;P&gt;DATA &lt;STRONG&gt;GroupCode&lt;/STRONG&gt;;&lt;BR /&gt;SET Emfuleni.GroupCodeTemp;&lt;BR /&gt;BY szAccountNumber;&lt;BR /&gt;IF FIRST.szAccountNumber THEN count=1;&lt;BR /&gt;else count+1;&lt;BR /&gt;IF count&amp;gt;2 THEN delete;&lt;BR /&gt;drop count;&lt;BR /&gt;RUN;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I suspect that this line&lt;/P&gt;
&lt;P&gt;merge Emfuleni.ptp Emfuleni.masterward(in = a where = (open eq 1)) &lt;SPAN&gt;Emfuleni.Arrears&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;Emfuleni.groupcode&lt;/STRONG&gt; ;&lt;/P&gt;
&lt;P&gt;refers to an earlier version of the data set Emfuleni.groupcode and you mean to use either:&lt;/P&gt;
&lt;P&gt;merge Emfuleni.ptp Emfuleni.masterward(in = a where = (open eq 1)) &lt;SPAN&gt;Emfuleni.Arrears&amp;nbsp;&lt;STRONG&gt;G&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;STRONG&gt;roupcode&lt;/STRONG&gt; ;&lt;/P&gt;
&lt;P&gt;or to name the data set Groupcode as Emfuleni.groupcode.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;With your Ward_Description as all missing (blank) in Groupcode I suspect that your results may not be what you want for the LastJoin.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 09 Sep 2016 14:49:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Merge-and-By-Variable-Issue/m-p/297410#M20266</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2016-09-09T14:49:47Z</dc:date>
    </item>
  </channel>
</rss>

