<?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 Two data set or Nested Data set in SAS Enterprise Guide</title>
    <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Merge-Two-data-set-or-Nested-Data-set/m-p/434480#M28063</link>
    <description>&lt;P&gt;HI,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; I have two data set and i want to search one data set to another when exact match is found increment 5% in both number_of_items and value, i know i can do it with merge but i am not able to do it because there four variable which is missing in any order. can i do it with the help of nested loop i tried but it giving me wrong result and gets merge which don't want. i need value from purchase data set only.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data sets&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;DATA product;&lt;BR /&gt;INFILE DATALINES DELIMITER=',' DSD;&lt;BR /&gt;INPUT k1 $ k2 $ k3 $ k4 $;&lt;BR /&gt;DATALINES;&lt;BR /&gt;63,,9141,1501&lt;BR /&gt;51,214,9280,,&lt;BR /&gt;57,,,1505&lt;BR /&gt;1,150,9172,,&lt;BR /&gt;58,214,,,&lt;BR /&gt;64,120,9666,,&lt;BR /&gt;,,,641&lt;BR /&gt;RUN;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;DATA purchase;&lt;BR /&gt;INFILE DATALINES DELIMITER=',' DSD;&lt;BR /&gt;INPUT k1 $ k2 $ k3 $ k4 $ number_items value;&lt;BR /&gt;DATALINES;&lt;BR /&gt;63,,9141,1501,10,10&lt;BR /&gt;51,214,9280,1502,10,10&lt;BR /&gt;57,,,1505,10,10&lt;BR /&gt;1,150,9172,,10,10&lt;BR /&gt;58,214,9180,,10,10&lt;BR /&gt;59,214,9180,,10,10&lt;BR /&gt;64,120,9666,,10,10&lt;BR /&gt;RUN;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;my approach if every value is present and need to find exact match.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data want;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; merge product(in=pro_in) purchase(in=pur_in);&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;by key1 key2 key3 key4;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;if pro_in and pur_in then&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;do;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; *perform action ;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;end;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;but my below code will not work because of missing value so i tried this it is not giving me result&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data want;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; merge product(in=pro_in) purchase(in=pur_in);&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;by key1 key2 key3 key4;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;if k1 ne '' and k2 ne '' and k3 ne '' and k4 ne '' then&lt;BR /&gt;do;&lt;BR /&gt;&lt;BR /&gt;end;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;else if k1 = '' and k2 ne '' and k3 ne '' and k4 ne '' then&lt;BR /&gt;do;&lt;BR /&gt;*perform action ;&lt;BR /&gt;end;&lt;/P&gt;&lt;P&gt;* so on different condition;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;product&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="product.PNG" style="width: 396px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/18351iCE0B42BD76550E93/image-size/large?v=v2&amp;amp;px=999" role="button" title="product.PNG" alt="product.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;purchase&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="purchase.PNG" style="width: 584px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/18352i01E43C185ACEF96B/image-size/large?v=v2&amp;amp;px=999" role="button" title="purchase.PNG" alt="purchase.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;desire output&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="output.PNG" style="width: 587px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/18353i9DCD659B5E9755AF/image-size/large?v=v2&amp;amp;px=999" role="button" title="output.PNG" alt="output.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;can i do it with nested loop or merge with given constraints? please provide hint or solution.&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 06 Feb 2018 09:58:42 GMT</pubDate>
    <dc:creator>rsathe</dc:creator>
    <dc:date>2018-02-06T09:58:42Z</dc:date>
    <item>
      <title>Merge Two data set or Nested Data set</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Merge-Two-data-set-or-Nested-Data-set/m-p/434480#M28063</link>
      <description>&lt;P&gt;HI,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; I have two data set and i want to search one data set to another when exact match is found increment 5% in both number_of_items and value, i know i can do it with merge but i am not able to do it because there four variable which is missing in any order. can i do it with the help of nested loop i tried but it giving me wrong result and gets merge which don't want. i need value from purchase data set only.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data sets&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;DATA product;&lt;BR /&gt;INFILE DATALINES DELIMITER=',' DSD;&lt;BR /&gt;INPUT k1 $ k2 $ k3 $ k4 $;&lt;BR /&gt;DATALINES;&lt;BR /&gt;63,,9141,1501&lt;BR /&gt;51,214,9280,,&lt;BR /&gt;57,,,1505&lt;BR /&gt;1,150,9172,,&lt;BR /&gt;58,214,,,&lt;BR /&gt;64,120,9666,,&lt;BR /&gt;,,,641&lt;BR /&gt;RUN;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;DATA purchase;&lt;BR /&gt;INFILE DATALINES DELIMITER=',' DSD;&lt;BR /&gt;INPUT k1 $ k2 $ k3 $ k4 $ number_items value;&lt;BR /&gt;DATALINES;&lt;BR /&gt;63,,9141,1501,10,10&lt;BR /&gt;51,214,9280,1502,10,10&lt;BR /&gt;57,,,1505,10,10&lt;BR /&gt;1,150,9172,,10,10&lt;BR /&gt;58,214,9180,,10,10&lt;BR /&gt;59,214,9180,,10,10&lt;BR /&gt;64,120,9666,,10,10&lt;BR /&gt;RUN;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;my approach if every value is present and need to find exact match.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data want;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; merge product(in=pro_in) purchase(in=pur_in);&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;by key1 key2 key3 key4;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;if pro_in and pur_in then&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;do;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; *perform action ;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;end;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;but my below code will not work because of missing value so i tried this it is not giving me result&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data want;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; merge product(in=pro_in) purchase(in=pur_in);&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;by key1 key2 key3 key4;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;if k1 ne '' and k2 ne '' and k3 ne '' and k4 ne '' then&lt;BR /&gt;do;&lt;BR /&gt;&lt;BR /&gt;end;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;else if k1 = '' and k2 ne '' and k3 ne '' and k4 ne '' then&lt;BR /&gt;do;&lt;BR /&gt;*perform action ;&lt;BR /&gt;end;&lt;/P&gt;&lt;P&gt;* so on different condition;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;product&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="product.PNG" style="width: 396px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/18351iCE0B42BD76550E93/image-size/large?v=v2&amp;amp;px=999" role="button" title="product.PNG" alt="product.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;purchase&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="purchase.PNG" style="width: 584px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/18352i01E43C185ACEF96B/image-size/large?v=v2&amp;amp;px=999" role="button" title="purchase.PNG" alt="purchase.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;desire output&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="output.PNG" style="width: 587px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/18353i9DCD659B5E9755AF/image-size/large?v=v2&amp;amp;px=999" role="button" title="output.PNG" alt="output.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;can i do it with nested loop or merge with given constraints? please provide hint or solution.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 06 Feb 2018 09:58:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Merge-Two-data-set-or-Nested-Data-set/m-p/434480#M28063</guid>
      <dc:creator>rsathe</dc:creator>
      <dc:date>2018-02-06T09:58:42Z</dc:date>
    </item>
    <item>
      <title>Re: Merge Two data set or Nested Data set</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Merge-Two-data-set-or-Nested-Data-set/m-p/434485#M28064</link>
      <description>&lt;P&gt;Please post example datasets that illustrate your issue. Post them in datasteps with datalines, so we can easily recreate your data.&lt;/P&gt;</description>
      <pubDate>Tue, 06 Feb 2018 08:21:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Merge-Two-data-set-or-Nested-Data-set/m-p/434485#M28064</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2018-02-06T08:21:21Z</dc:date>
    </item>
    <item>
      <title>Re: Merge Two data set or Nested Data set</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Merge-Two-data-set-or-Nested-Data-set/m-p/434498#M28067</link>
      <description>&lt;P&gt;Hi KurtBremser,&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp;I update my question with data sets.&lt;/P&gt;&lt;P&gt;&lt;SPAN class="login-bold"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 06 Feb 2018 10:00:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Merge-Two-data-set-or-Nested-Data-set/m-p/434498#M28067</guid>
      <dc:creator>rsathe</dc:creator>
      <dc:date>2018-02-06T10:00:01Z</dc:date>
    </item>
  </channel>
</rss>

