<?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: how to get the highest profit per each Sub_Category in each year? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/how-to-get-the-highest-profit-per-each-Sub-Category-in-each-year/m-p/610366#M177741</link>
    <description>&lt;P&gt;Thanks for your reply. Sorry, it doesn't work. Here is screenshot of the resulting data&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="image.png" style="width: 600px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/34557i80C45F53A4817BE9/image-size/large?v=v2&amp;amp;px=999" role="button" title="image.png" alt="image.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
    <pubDate>Mon, 09 Dec 2019 03:20:58 GMT</pubDate>
    <dc:creator>mrahouma</dc:creator>
    <dc:date>2019-12-09T03:20:58Z</dc:date>
    <item>
      <title>how to get the highest profit per each Sub_Category in each year?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-get-the-highest-profit-per-each-Sub-Category-in-each-year/m-p/610363#M177739</link>
      <description>&lt;P&gt;I have the attached database and&amp;nbsp;I want to get table with the highest profit per each Sub_Category in each year?&lt;/P&gt;
&lt;P&gt;My data as follow&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;TABLE width="273"&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD width="91"&gt;Sub_Category&lt;/TD&gt;
&lt;TD width="91"&gt;order_year&lt;/TD&gt;
&lt;TD width="91"&gt;profit&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;Paper&lt;/TD&gt;
&lt;TD&gt;2017&lt;/TD&gt;
&lt;TD&gt;178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
&lt;TD&gt;26.165&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;Phones&lt;/TD&gt;
&lt;TD&gt;2015&lt;/TD&gt;
&lt;TD&gt;26.08916667&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;Furnishings&lt;/TD&gt;
&lt;TD&gt;2015&lt;/TD&gt;
&lt;TD&gt;25.35&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;Any advice will be greatly appreciated&lt;/P&gt;</description>
      <pubDate>Mon, 09 Dec 2019 03:11:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-get-the-highest-profit-per-each-Sub-Category-in-each-year/m-p/610363#M177739</guid>
      <dc:creator>mrahouma</dc:creator>
      <dc:date>2019-12-09T03:11:41Z</dc:date>
    </item>
    <item>
      <title>Re: how to get the highest profit per each Sub_Category in each year?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-get-the-highest-profit-per-each-Sub-Category-in-each-year/m-p/610364#M177740</link>
      <description>&lt;P&gt;Please try the below untested code&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
create table want as select sub_category, order_year, max(profit) as profit 
from have group by sub_category, order_year;
quit;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 09 Dec 2019 03:14:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-get-the-highest-profit-per-each-Sub-Category-in-each-year/m-p/610364#M177740</guid>
      <dc:creator>Jagadishkatam</dc:creator>
      <dc:date>2019-12-09T03:14:35Z</dc:date>
    </item>
    <item>
      <title>Re: how to get the highest profit per each Sub_Category in each year?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-get-the-highest-profit-per-each-Sub-Category-in-each-year/m-p/610366#M177741</link>
      <description>&lt;P&gt;Thanks for your reply. Sorry, it doesn't work. Here is screenshot of the resulting data&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="image.png" style="width: 600px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/34557i80C45F53A4817BE9/image-size/large?v=v2&amp;amp;px=999" role="button" title="image.png" alt="image.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 09 Dec 2019 03:20:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-get-the-highest-profit-per-each-Sub-Category-in-each-year/m-p/610366#M177741</guid>
      <dc:creator>mrahouma</dc:creator>
      <dc:date>2019-12-09T03:20:58Z</dc:date>
    </item>
    <item>
      <title>Re: how to get the highest profit per each Sub_Category in each year?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-get-the-highest-profit-per-each-Sub-Category-in-each-year/m-p/610367#M177742</link>
      <description>&lt;P&gt;Please try&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;
proc sort data=have ;
by sub_category descending profit order_year ;
run;

data want;
set have;
by sub_category descending profit  order_year ;
if first.sub_category;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 09 Dec 2019 03:32:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-get-the-highest-profit-per-each-Sub-Category-in-each-year/m-p/610367#M177742</guid>
      <dc:creator>Jagadishkatam</dc:creator>
      <dc:date>2019-12-09T03:32:24Z</dc:date>
    </item>
    <item>
      <title>Re: how to get the highest profit per each Sub_Category in each year?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-get-the-highest-profit-per-each-Sub-Category-in-each-year/m-p/610368#M177743</link>
      <description>Thanks. Appreciated</description>
      <pubDate>Mon, 09 Dec 2019 03:48:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-get-the-highest-profit-per-each-Sub-Category-in-each-year/m-p/610368#M177743</guid>
      <dc:creator>mrahouma</dc:creator>
      <dc:date>2019-12-09T03:48:58Z</dc:date>
    </item>
  </channel>
</rss>

