<?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 How to I group Sales with sales person in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-I-group-Sales-with-sales-person/m-p/777528#M247384</link>
    <description>&lt;P&gt;&lt;SPAN&gt;I have a file of raw data(given below) and&amp;nbsp;I am hoping to turn it in to the&amp;nbsp;&lt;/SPAN&gt;output (given below) by using a &lt;STRONG&gt;single data step.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Each observation contains only the following variables: the salesperson’s name (character type of length at least 20), the salesperson’s latest sales date (in SAS DATE numeric values), the number of days (standard numeric type) between the salesperson’s latest date of sales and the 30th of September 2021 (For example, if the latest sales date is 29/Sep/2021, then the number of days between the latest date of sales and the 30th of September 2021 is 1.), and the salesperson’s total sales (standard numeric type).&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Raw Data:&lt;/STRONG&gt;&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&lt;P&gt;David Wong,1/Sep/2021,13200&lt;/P&gt;&lt;P&gt;Brian Leung,15/Sep/2021,23450&lt;/P&gt;&lt;P&gt;Brian Leung,10/Sep/2021,33000&lt;/P&gt;&lt;P&gt;Mary Chan,3/Sep/2021,45600&lt;/P&gt;&lt;P&gt;Mary Chan,20/Sep/2021,37800&lt;/P&gt;&lt;P&gt;Mary Chan,1/Aug/2021,21500&lt;/P&gt;&lt;P&gt;Mary Chan,30/Aug/2021,42000&lt;/P&gt;&lt;P&gt;John Tam,12/Sep/2021,35000&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Output&lt;/STRONG&gt;:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Cheggg1111_1-1635632071887.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/65266iE56D25C53946EC9B/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Cheggg1111_1-1635632071887.png" alt="Cheggg1111_1-1635632071887.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Sat, 30 Oct 2021 22:18:59 GMT</pubDate>
    <dc:creator>Cheggg1111</dc:creator>
    <dc:date>2021-10-30T22:18:59Z</dc:date>
    <item>
      <title>How to I group Sales with sales person</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-I-group-Sales-with-sales-person/m-p/777528#M247384</link>
      <description>&lt;P&gt;&lt;SPAN&gt;I have a file of raw data(given below) and&amp;nbsp;I am hoping to turn it in to the&amp;nbsp;&lt;/SPAN&gt;output (given below) by using a &lt;STRONG&gt;single data step.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Each observation contains only the following variables: the salesperson’s name (character type of length at least 20), the salesperson’s latest sales date (in SAS DATE numeric values), the number of days (standard numeric type) between the salesperson’s latest date of sales and the 30th of September 2021 (For example, if the latest sales date is 29/Sep/2021, then the number of days between the latest date of sales and the 30th of September 2021 is 1.), and the salesperson’s total sales (standard numeric type).&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Raw Data:&lt;/STRONG&gt;&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&lt;P&gt;David Wong,1/Sep/2021,13200&lt;/P&gt;&lt;P&gt;Brian Leung,15/Sep/2021,23450&lt;/P&gt;&lt;P&gt;Brian Leung,10/Sep/2021,33000&lt;/P&gt;&lt;P&gt;Mary Chan,3/Sep/2021,45600&lt;/P&gt;&lt;P&gt;Mary Chan,20/Sep/2021,37800&lt;/P&gt;&lt;P&gt;Mary Chan,1/Aug/2021,21500&lt;/P&gt;&lt;P&gt;Mary Chan,30/Aug/2021,42000&lt;/P&gt;&lt;P&gt;John Tam,12/Sep/2021,35000&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Output&lt;/STRONG&gt;:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Cheggg1111_1-1635632071887.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/65266iE56D25C53946EC9B/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Cheggg1111_1-1635632071887.png" alt="Cheggg1111_1-1635632071887.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 30 Oct 2021 22:18:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-I-group-Sales-with-sales-person/m-p/777528#M247384</guid>
      <dc:creator>Cheggg1111</dc:creator>
      <dc:date>2021-10-30T22:18:59Z</dc:date>
    </item>
    <item>
      <title>How do I get the following output by only using one data step</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-I-group-Sales-with-sales-person/m-p/777531#M247389</link>
      <description>&lt;P&gt;How to I get the output (given below) from the raw data (given) by only using &lt;STRONG&gt;one Data Step.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Raw Data:&lt;/STRONG&gt;&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&lt;P&gt;David Wong,1/Sep/2021,13200&lt;/P&gt;&lt;P&gt;Brian Leung,15/Sep/2021,23450&lt;/P&gt;&lt;P&gt;Brian Leung,10/Sep/2021,33000&lt;/P&gt;&lt;P&gt;Mary Chan,3/Sep/2021,45600&lt;/P&gt;&lt;P&gt;Mary Chan,20/Sep/2021,37800&lt;/P&gt;&lt;P&gt;Mary Chan,1/Aug/2021,21500&lt;/P&gt;&lt;P&gt;Mary Chan,30/Aug/2021,42000&lt;/P&gt;&lt;P&gt;John Tam,12/Sep/2021,35000&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;SPAN&gt;Each observation contains only the following variables: the salesperson’s name (character type of length at least 20), the salesperson’s latest sales date (in SAS DATE numeric values), the number of days (standard numeric type) between the salesperson’s latest date of sales and the 30th of September 2021 (For example, if the latest sales date is 29/Sep/2021, then the number of days between the latest date of sales and the 30th of September 2021 is 1.), and the salesperson’s total sales (standard numeric type).&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Output:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Cheggg1111_1-1635632934651.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/65268i97F6DD87341902E0/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Cheggg1111_1-1635632934651.png" alt="Cheggg1111_1-1635632934651.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;</description>
      <pubDate>Sat, 30 Oct 2021 22:30:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-I-group-Sales-with-sales-person/m-p/777531#M247389</guid>
      <dc:creator>Cheggg1111</dc:creator>
      <dc:date>2021-10-30T22:30:29Z</dc:date>
    </item>
    <item>
      <title>Re: How do I get the following output by only using one data step</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-I-group-Sales-with-sales-person/m-p/777532#M247390</link>
      <description>&lt;P&gt;Welcome to the SAS Forum.&lt;/P&gt;
&lt;P&gt;Going forward please post your questions only once.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;What have you tried already?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here some pointers:&lt;/P&gt;
&lt;P&gt;1. Your source data must be sorted by salesperson and date (if that's not the case the use Proc Sort)&lt;/P&gt;
&lt;P&gt;2. The data must be read into SAS as a SAS Date value (use the appropriate SAS date informat in the input step, apply a SAS date format to the variable).&lt;/P&gt;
&lt;P&gt;3. Use by salesperson name and first/last logic in the data step&lt;/P&gt;
&lt;P&gt;- sales_tot+sales&lt;/P&gt;
&lt;P&gt;- if last.salesperson then do; no_days=sales_date - '30sep2021'd;output; call missing(sales_tot); end;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can find an answer with code &lt;A href="https://communities.sas.com/t5/SAS-Programming/Urgent-How-can-I-set-the-name-as-array/m-p/777509/highlight/false#M247371" target="_self"&gt;here&lt;/A&gt; - but suggest you give this first a try on your own.&lt;/P&gt;</description>
      <pubDate>Sat, 30 Oct 2021 23:32:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-I-group-Sales-with-sales-person/m-p/777532#M247390</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2021-10-30T23:32:23Z</dc:date>
    </item>
    <item>
      <title>Re: How to I group Sales with sales person</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-I-group-Sales-with-sales-person/m-p/777545#M247392</link>
      <description>&lt;P&gt;I merged your double post.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;See my answer in your classmate's thread (&lt;A href="https://communities.sas.com/t5/SAS-Programming/Urgent-How-can-I-set-the-name-as-array/td-p/777509/jump-to/first-unread-message" target="_blank" rel="noopener"&gt;here&lt;/A&gt;).&lt;/P&gt;</description>
      <pubDate>Sun, 31 Oct 2021 08:29:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-I-group-Sales-with-sales-person/m-p/777545#M247392</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2021-10-31T08:29:38Z</dc:date>
    </item>
    <item>
      <title>Re: How do I get the following output by only using one data step</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-I-group-Sales-with-sales-person/m-p/777546#M247393</link>
      <description>This can be done (but not by me) in a single DATA step, using unsorted raw data, using a hash table that uses NAME as the key.&lt;BR /&gt;&lt;BR /&gt;Results would be in alphabetical order.</description>
      <pubDate>Sun, 31 Oct 2021 06:30:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-I-group-Sales-with-sales-person/m-p/777546#M247393</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2021-10-31T06:30:18Z</dc:date>
    </item>
    <item>
      <title>Re: How do I get the following output by only using one data step</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-I-group-Sales-with-sales-person/m-p/777666#M247443</link>
      <description>&lt;P&gt;Do you have a SAS dataset or do you want to read an external file and do the calculations while reading it?&lt;/P&gt;</description>
      <pubDate>Mon, 01 Nov 2021 13:08:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-I-group-Sales-with-sales-person/m-p/777666#M247443</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2021-11-01T13:08:19Z</dc:date>
    </item>
  </channel>
</rss>

