<?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: Merging Issue in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Merging-Issue/m-p/341430#M78140</link>
    <description>&lt;P&gt;Look at the UPDATE statement instead of a merge.&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 16 Mar 2017 05:40:03 GMT</pubDate>
    <dc:creator>Reeza</dc:creator>
    <dc:date>2017-03-16T05:40:03Z</dc:date>
    <item>
      <title>Merging Issue</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Merging-Issue/m-p/341419#M78137</link>
      <description>&lt;P&gt;Have 2 datasets Old &amp;amp; New, Old have some location id with its details field, the new list have location id only details field will be blank.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Dataset New&lt;/STRONG&gt; :-&lt;/P&gt;&lt;P&gt;Location id &amp;nbsp; &amp;nbsp;Area &amp;nbsp; &amp;nbsp;Phone&lt;BR /&gt;1234&lt;BR /&gt;2345&lt;BR /&gt;1233&lt;BR /&gt;5543&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Dataset Old :-&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Location id &amp;nbsp; Area &amp;nbsp; &amp;nbsp; Phone&lt;BR /&gt;1234 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;NYC &amp;nbsp; &amp;nbsp; 55555&lt;BR /&gt;2345 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ABC &amp;nbsp; &amp;nbsp; 77777&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Output Dataset Expected&lt;/STRONG&gt;:&lt;/P&gt;&lt;P&gt;Location id Area Phone&lt;BR /&gt;1234 NYC 55555&lt;BR /&gt;2345 ABC 77777&lt;BR /&gt;1233&lt;BR /&gt;5543&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Code written:-&lt;/P&gt;&lt;P&gt;proc sort data=New nodupkey;by merchant_market_hierarchy_id;&lt;/P&gt;&lt;P&gt;proc sort data=Old nodupkey;by merchant_market_hierarchy_id;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data New;&lt;BR /&gt;merge New(in=ln) Old(in=lo);&lt;BR /&gt;by location_id;&lt;BR /&gt;if ln;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My output is not as expected.&amp;nbsp;&lt;/P&gt;&lt;P&gt;What am i doing wrong here? would require some help on this please!&lt;/P&gt;</description>
      <pubDate>Thu, 16 Mar 2017 04:51:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Merging-Issue/m-p/341419#M78137</guid>
      <dc:creator>GunnerEP</dc:creator>
      <dc:date>2017-03-16T04:51:08Z</dc:date>
    </item>
    <item>
      <title>Re: Merging Issue</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Merging-Issue/m-p/341426#M78138</link>
      <description>&lt;P&gt;Because location 1234 and 2345 is blank in New. The merged data&amp;nbsp;will be the data from Old covered by New due to "if in".&lt;BR /&gt;&lt;BR /&gt;Maybe you can try to merge New with Old without "if in;".&lt;/P&gt;</description>
      <pubDate>Thu, 16 Mar 2017 05:14:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Merging-Issue/m-p/341426#M78138</guid>
      <dc:creator>JohnChen_TW</dc:creator>
      <dc:date>2017-03-16T05:14:52Z</dc:date>
    </item>
    <item>
      <title>Re: Merging Issue</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Merging-Issue/m-p/341428#M78139</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I see the code to be fine, may be that while the New dataset is being read into a dataset the missing fields are not considered in the expected way.I would suggest to use MISSOVER option in the infile and then try the code .It must do your job.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Example:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Data New;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;infile datalines missover;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;input Location_id Area$ Phone;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;datalines;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;1234 &lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;2345 &lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;1233 &lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;5543 &lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;run;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Data Old;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;Input Location_id Area$ Phone;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;Datalines;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;1234 NYC 55555&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;2345 ABC 77777&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;run;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;proc sort data=New nodupkey;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;by Location_id;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;Run;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;proc sort data=Old nodupkey;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;by location_id;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;Run;&lt;/STRONG&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;STRONG&gt;data New1;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;merge New(in=a) OLD(in=b);&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;by location_id;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;if a;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;run;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;GP&lt;/P&gt;</description>
      <pubDate>Thu, 16 Mar 2017 05:37:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Merging-Issue/m-p/341428#M78139</guid>
      <dc:creator>GPNaveen</dc:creator>
      <dc:date>2017-03-16T05:37:52Z</dc:date>
    </item>
    <item>
      <title>Re: Merging Issue</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Merging-Issue/m-p/341430#M78140</link>
      <description>&lt;P&gt;Look at the UPDATE statement instead of a merge.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 16 Mar 2017 05:40:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Merging-Issue/m-p/341430#M78140</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2017-03-16T05:40:03Z</dc:date>
    </item>
    <item>
      <title>Re: Merging Issue</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Merging-Issue/m-p/341434#M78145</link>
      <description>&lt;P&gt;you've especially &amp;nbsp;asked for merge statement but you can solve it by sql statement;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;DATA NEW;&lt;BR /&gt;INPUT Location_id;&lt;BR /&gt;DATALINES;&lt;BR /&gt;1234&lt;BR /&gt;2345&lt;BR /&gt;1233&lt;BR /&gt;5543&lt;BR /&gt;;&lt;BR /&gt;RUN;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;DATA OLD;&lt;BR /&gt;INPUT Location_id Area $ Phone $;&lt;BR /&gt;DATALINES;&lt;BR /&gt;1234 NYC 55555&lt;BR /&gt;2345 ABC 77777&lt;BR /&gt;;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;PROC SQL;&lt;BR /&gt;CREATE TABLE WORK.QUERY_FOR_NEW AS&lt;BR /&gt;SELECT t1.Location_id,&lt;BR /&gt;t2.Area,&lt;BR /&gt;t2.Phone&lt;BR /&gt;FROM WORK.NEW t1&lt;BR /&gt;LEFT JOIN WORK.OLD t2 ON (t1.Location_id = t2.Location_id);&lt;BR /&gt;QUIT;&lt;/P&gt;</description>
      <pubDate>Thu, 16 Mar 2017 06:09:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Merging-Issue/m-p/341434#M78145</guid>
      <dc:creator>Yavuz</dc:creator>
      <dc:date>2017-03-16T06:09:39Z</dc:date>
    </item>
    <item>
      <title>Re: Merging Issue</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Merging-Issue/m-p/341440#M78147</link>
      <description>Thanks Naveen. Code was fine.. i had trouble with the input dataset only. Got it fixed &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;</description>
      <pubDate>Thu, 16 Mar 2017 07:26:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Merging-Issue/m-p/341440#M78147</guid>
      <dc:creator>GunnerEP</dc:creator>
      <dc:date>2017-03-16T07:26:10Z</dc:date>
    </item>
  </channel>
</rss>

