<?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 find the maximum number of sales in datastep? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-find-the-maximum-number-of-sales-in-datastep/m-p/257096#M49325</link>
    <description>&lt;P&gt;Just curious ... why are you insisting on a DATA step solution?&amp;nbsp; Both PROC SQL and PROC SUMMARY can easily handle this without the need to sort your data.&lt;/P&gt;</description>
    <pubDate>Wed, 16 Mar 2016 18:38:09 GMT</pubDate>
    <dc:creator>Astounding</dc:creator>
    <dc:date>2016-03-16T18:38:09Z</dc:date>
    <item>
      <title>How to find the maximum number of sales in datastep?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-find-the-maximum-number-of-sales-in-datastep/m-p/257074#M49316</link>
      <description>&lt;P&gt;I wish to know the way to find out the maximum number of sales amount by each salesperson via datastep.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I've a data like this&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Salesid &amp;nbsp; &amp;nbsp; Sales_amount &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Salesperson&lt;/P&gt;
&lt;P&gt;001 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 100 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Dean&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;001 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 200 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Dean&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;002 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 300 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Tom&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;002 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 700 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;SPAN&gt;T&lt;/SPAN&gt;&lt;SPAN&gt;om&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;003 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 500 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;Jacob&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;003 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 400 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;J&lt;SPAN&gt;acob&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&lt;SPAN&gt;Desired output should be like this&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Salesid &amp;nbsp; &amp;nbsp; Sales_amount &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Salesperson&lt;/P&gt;
&lt;P&gt;001 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 200 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Dean&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;002 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 700 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;SPAN&gt;Tom&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;003 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 500 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;SPAN&gt;Jacob&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&lt;SPAN&gt;Thanks for any help you offer me.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 16 Mar 2016 17:26:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-find-the-maximum-number-of-sales-in-datastep/m-p/257074#M49316</guid>
      <dc:creator>Babloo</dc:creator>
      <dc:date>2016-03-16T17:26:41Z</dc:date>
    </item>
    <item>
      <title>Re: How to find the maximum number of sales in datastep?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-find-the-maximum-number-of-sales-in-datastep/m-p/257083#M49319</link>
      <description>&lt;P&gt;Sort descending and then take the first record for the table.&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 salesid descending sales_amount;
run;

data want;
set have;
by salesid;
if first.salesid;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 16 Mar 2016 17:49:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-find-the-maximum-number-of-sales-in-datastep/m-p/257083#M49319</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2016-03-16T17:49:53Z</dc:date>
    </item>
    <item>
      <title>Re: How to find the maximum number of sales in datastep?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-find-the-maximum-number-of-sales-in-datastep/m-p/257088#M49321</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/8409"&gt;@Babloo﻿&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Alternatively, you could use a double DOW loop:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
input Salesid $ Sales_amount Salesperson $;
cards;
001 100 Dean
001 200 Dean
002 300 Tom
002 700 Tom
003 500 Jacob
003 400 Jacob
;

data want;
do until(last.salesid);
  set have;
  by salesid;
  maxamt=max(maxamt,sales_amount);
end;
do until(last.salesid);
  set have;
  by salesid;
end;
drop sales_amount;
rename maxamt=Sales_amount;
run;

proc print data=want noobs;
var salesid sales_amount salesperson;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 16 Mar 2016 18:04:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-find-the-maximum-number-of-sales-in-datastep/m-p/257088#M49321</guid>
      <dc:creator>FreelanceReinh</dc:creator>
      <dc:date>2016-03-16T18:04:43Z</dc:date>
    </item>
    <item>
      <title>Re: How to find the maximum number of sales in datastep?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-find-the-maximum-number-of-sales-in-datastep/m-p/257096#M49325</link>
      <description>&lt;P&gt;Just curious ... why are you insisting on a DATA step solution?&amp;nbsp; Both PROC SQL and PROC SUMMARY can easily handle this without the need to sort your data.&lt;/P&gt;</description>
      <pubDate>Wed, 16 Mar 2016 18:38:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-find-the-maximum-number-of-sales-in-datastep/m-p/257096#M49325</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2016-03-16T18:38:09Z</dc:date>
    </item>
  </channel>
</rss>

