<?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 application of in in merge in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/application-of-in-in-merge/m-p/670472#M201282</link>
    <description>&lt;P&gt;These are the two questions given&lt;/P&gt;&lt;P&gt;1) Explicitly output rows for products with sales (matches&amp;nbsp;&lt;BR /&gt;products in the profit table) to the profit_detail table.&amp;nbsp;&lt;BR /&gt;*2) Explicitly output rows for products without sales to the *&lt;BR /&gt;&amp;nbsp;product_nosales table.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc sort data=crb.profit out=profit_sort;&lt;BR /&gt;by Product_ID;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;proc sort data=crb.products out=products_sort;&lt;BR /&gt;by Product_ID;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;data profit_detail product_nosales;&lt;BR /&gt;merge profit_sort(in=inprof) products_sort(in=inprod);&lt;BR /&gt;by Product_ID;&lt;BR /&gt;if inprof=1 and inprod=1 then output profit_detail;&lt;BR /&gt;&lt;EM&gt;&lt;STRONG&gt;else if inprof=0 and inprod=1 then output product_nosales;&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;(i didnt understood how from the question this statment was written .I felt the question was not quite clear,Can someone please explain)&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;proc print data=product_detail;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;proc print data=product_nosales;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/159"&gt;@Tom&lt;/a&gt;&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/32733"&gt;@FreelanceReinh&lt;/a&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Sun, 19 Jul 2020 16:02:41 GMT</pubDate>
    <dc:creator>veda8</dc:creator>
    <dc:date>2020-07-19T16:02:41Z</dc:date>
    <item>
      <title>application of in in merge</title>
      <link>https://communities.sas.com/t5/SAS-Programming/application-of-in-in-merge/m-p/670472#M201282</link>
      <description>&lt;P&gt;These are the two questions given&lt;/P&gt;&lt;P&gt;1) Explicitly output rows for products with sales (matches&amp;nbsp;&lt;BR /&gt;products in the profit table) to the profit_detail table.&amp;nbsp;&lt;BR /&gt;*2) Explicitly output rows for products without sales to the *&lt;BR /&gt;&amp;nbsp;product_nosales table.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc sort data=crb.profit out=profit_sort;&lt;BR /&gt;by Product_ID;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;proc sort data=crb.products out=products_sort;&lt;BR /&gt;by Product_ID;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;data profit_detail product_nosales;&lt;BR /&gt;merge profit_sort(in=inprof) products_sort(in=inprod);&lt;BR /&gt;by Product_ID;&lt;BR /&gt;if inprof=1 and inprod=1 then output profit_detail;&lt;BR /&gt;&lt;EM&gt;&lt;STRONG&gt;else if inprof=0 and inprod=1 then output product_nosales;&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;(i didnt understood how from the question this statment was written .I felt the question was not quite clear,Can someone please explain)&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;proc print data=product_detail;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;proc print data=product_nosales;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/159"&gt;@Tom&lt;/a&gt;&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/32733"&gt;@FreelanceReinh&lt;/a&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 19 Jul 2020 16:02:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/application-of-in-in-merge/m-p/670472#M201282</guid>
      <dc:creator>veda8</dc:creator>
      <dc:date>2020-07-19T16:02:41Z</dc:date>
    </item>
    <item>
      <title>Re: application of in in merge</title>
      <link>https://communities.sas.com/t5/SAS-Programming/application-of-in-in-merge/m-p/670478#M201285</link>
      <description>&lt;P&gt;Your answer looks good to me.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;When I am answering a question that seems be imprecisely worded I like to explicitly state how I have interpreted the question and any assumptions I have to make to be able to provide an answer.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 19 Jul 2020 17:09:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/application-of-in-in-merge/m-p/670478#M201285</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2020-07-19T17:09:23Z</dc:date>
    </item>
    <item>
      <title>Re: application of in in merge</title>
      <link>https://communities.sas.com/t5/SAS-Programming/application-of-in-in-merge/m-p/670486#M201290</link>
      <description>&lt;P&gt;Take a good look at your code:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data profit_detail product_nosales;
merge profit_sort(in=inprof) products_sort(in=inprod);
by Product_ID;
if inprof=1 and inprod=1 then output profit_detail;
else if inprof=0 and inprod=1 then output product_nosales;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;In both conditions that lead to an output, inprod must be 1 (true), so you can move that up and use a subsetting if:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;if inprod;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;and then direct the output depending on inprof, so the complete code would be:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data
  profit_detail
  product_nosales
;
merge
  profit_sort (in=inprof)
  products_sort (in=inprod)
;
by Product_ID;
if inprod;
if inprof
then output profit_detail;
else output product_nosales;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sun, 19 Jul 2020 18:10:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/application-of-in-in-merge/m-p/670486#M201290</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2020-07-19T18:10:50Z</dc:date>
    </item>
    <item>
      <title>Re: application of in in merge</title>
      <link>https://communities.sas.com/t5/SAS-Programming/application-of-in-in-merge/m-p/670567#M201327</link>
      <description>&lt;P&gt;the solution isnt written by me.I am not understanding from the question how they derived this solution ie. especially the second if statement&lt;/P&gt;</description>
      <pubDate>Mon, 20 Jul 2020 05:41:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/application-of-in-in-merge/m-p/670567#M201327</guid>
      <dc:creator>veda8</dc:creator>
      <dc:date>2020-07-20T05:41:19Z</dc:date>
    </item>
  </channel>
</rss>

