<?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: Calculation based on Count in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/Calculation-based-on-Count/m-p/508754#M1689</link>
    <description>I copied the code directly from the log so not sure why it isnt working:(&lt;BR /&gt;&lt;BR /&gt;Thank you for your help Reeza. I agree it would be simpler, but the requester is insistent that they see the breakout &lt;span class="lia-unicode-emoji" title=":confused_face:"&gt;😕&lt;/span&gt;</description>
    <pubDate>Tue, 30 Oct 2018 15:39:15 GMT</pubDate>
    <dc:creator>aperansi</dc:creator>
    <dc:date>2018-10-30T15:39:15Z</dc:date>
    <item>
      <title>Calculation based on Count</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Calculation-based-on-Count/m-p/508510#M1664</link>
      <description>&lt;P&gt;I have a data set that contains the counts for a vendor in each month for the past year.&amp;nbsp;The count is a representation of how much we use their product in a given month.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am trying to obtain the total price of what we owe the vendor based on the count multiplied by the price, but I dont know how to calculate this as there is a change in the price based on the amount we use their product.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For the first 150,000 times we use the product, we are charged $0.06. Anything after 150,000, we are charged $0.052500 each time we use the product.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would like the end result to show the total price for the first 150,000. And then the total price for the remaining portion of the count for each month, including the remaining variables I have listed in the below data set.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 27 Nov 2018 20:15:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Calculation-based-on-Count/m-p/508510#M1664</guid>
      <dc:creator>aperansi</dc:creator>
      <dc:date>2018-11-27T20:15:00Z</dc:date>
    </item>
    <item>
      <title>Re: Calculation based on Count</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Calculation-based-on-Count/m-p/508523#M1665</link>
      <description>&lt;P&gt;Here is a similar post that you might find useful:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="https://communities.sas.com/t5/New-SAS-User/If-statement-to-calculate-price-based-on-count/m-p/506531#M1344" target="_blank"&gt;https://communities.sas.com/t5/New-SAS-User/If-statement-to-calculate-price-based-on-count/m-p/506531#M1344&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 29 Oct 2018 21:33:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Calculation-based-on-Count/m-p/508523#M1665</guid>
      <dc:creator>pink_poodle</dc:creator>
      <dc:date>2018-10-29T21:33:54Z</dc:date>
    </item>
    <item>
      <title>Re: Calculation based on Count</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Calculation-based-on-Count/m-p/508525#M1666</link>
      <description>Post sample data as text, not an image and the expected output as much as possible aligned to the example data.</description>
      <pubDate>Mon, 29 Oct 2018 21:44:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Calculation-based-on-Count/m-p/508525#M1666</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-10-29T21:44:36Z</dc:date>
    </item>
    <item>
      <title>Re: Calculation based on Count</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Calculation-based-on-Count/m-p/508526#M1667</link>
      <description>Instructions on posting sample data is here: &lt;A href="https://communities.sas.com/t5/SAS-Communities-Library/How-to-create-a-data-step-version-of-your-data-AKA-generate/ta-p/258712" target="_blank"&gt;https://communities.sas.com/t5/SAS-Communities-Library/How-to-create-a-data-step-version-of-your-data-AKA-generate/ta-p/258712&lt;/A&gt;</description>
      <pubDate>Mon, 29 Oct 2018 21:44:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Calculation-based-on-Count/m-p/508526#M1667</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-10-29T21:44:56Z</dc:date>
    </item>
    <item>
      <title>Re: Calculation based on Count</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Calculation-based-on-Count/m-p/508585#M1670</link>
      <description>&lt;P&gt;Count seems to be expressed&amp;nbsp;in thousands, so you need&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;price150000 = min(count, 150)*1000*0.06;&lt;BR /&gt;totalPrice = max(0, count - 150)*1000*0.0525 + price150000;&lt;/P&gt;</description>
      <pubDate>Tue, 30 Oct 2018 05:14:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Calculation-based-on-Count/m-p/508585#M1670</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2018-10-30T05:14:25Z</dc:date>
    </item>
    <item>
      <title>Re: Calculation based on Count</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Calculation-based-on-Count/m-p/508683#M1683</link>
      <description>&lt;P&gt;My apologies Reeza. Here is the sample data as text.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data WORK.IOVATIONNOW2;&lt;BR /&gt;infile datalines dsd truncover;&lt;BR /&gt;input Date:YYMMD7. Count:COMMA20. mid:$20. product:$30. vendor:$30. Price:4.2 total_price:32.;&lt;BR /&gt;format Date YYMMD7. Count COMMA20. Price 4.2;&lt;BR /&gt;datalines;&lt;BR /&gt;2018-08 471,190 All Environments RM360 Iovation 0.06 25915.45&lt;BR /&gt;2018-06 385,706 All Environments RM360 Iovation 0.06 21213.83&lt;BR /&gt;2018-02 348,405 All Environments RM360 Iovation 0.06 19162.275&lt;BR /&gt;2018-10 144 All Environments RM360 Iovation 0.06 7.92&lt;BR /&gt;2018-05 362,751 All Environments RM360 Iovation 0.06 19951.305&lt;BR /&gt;;;;;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;here is what I need the data to return:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;2018-08 150,000 All Environments RM360 Iovation 0.06&amp;nbsp;9000&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;2018-08 321,190 All Environments RM360 Iovation 0.0525 16862.475&lt;BR /&gt;&lt;SPAN&gt;2018-06&amp;nbsp;150,000&amp;nbsp;All Environments RM360 Iovation 0.06&amp;nbsp;9000&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;2018-06 235,706 All Environments RM360 Iovation 0.0525 12374.565&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;2018-07 150,000 All Environments RM360 Iovation 0.06 9000&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;2018-07&amp;nbsp;198,405 All Environments RM360 Iovation 0.0525&amp;nbsp;10415.26&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;2018-05&amp;nbsp;150,000 All Environments RM360 Iovation 0.06 9000&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;2018-05&amp;nbsp;250,000 All Environments RM360 Iovation 0.06&amp;nbsp;13125.00&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 30 Oct 2018 13:41:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Calculation-based-on-Count/m-p/508683#M1683</guid>
      <dc:creator>aperansi</dc:creator>
      <dc:date>2018-10-30T13:41:33Z</dc:date>
    </item>
    <item>
      <title>Re: Calculation based on Count</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Calculation-based-on-Count/m-p/508737#M1686</link>
      <description>Your code doesn't run for me &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&lt;BR /&gt;&lt;BR /&gt;The solution is something along the lines of :&lt;BR /&gt;&lt;BR /&gt;if count&amp;gt;150000 then do;&lt;BR /&gt;remainder=total_price - 9000;&lt;BR /&gt;total_price=9000 ; output;&lt;BR /&gt;total_price=remainder; price=0.0525; output;&lt;BR /&gt;end;&lt;BR /&gt;&lt;BR /&gt;Personally, it's probably easier if the data was in the same row.</description>
      <pubDate>Tue, 30 Oct 2018 15:03:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Calculation-based-on-Count/m-p/508737#M1686</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-10-30T15:03:47Z</dc:date>
    </item>
    <item>
      <title>Re: Calculation based on Count</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Calculation-based-on-Count/m-p/508754#M1689</link>
      <description>I copied the code directly from the log so not sure why it isnt working:(&lt;BR /&gt;&lt;BR /&gt;Thank you for your help Reeza. I agree it would be simpler, but the requester is insistent that they see the breakout &lt;span class="lia-unicode-emoji" title=":confused_face:"&gt;😕&lt;/span&gt;</description>
      <pubDate>Tue, 30 Oct 2018 15:39:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Calculation-based-on-Count/m-p/508754#M1689</guid>
      <dc:creator>aperansi</dc:creator>
      <dc:date>2018-10-30T15:39:15Z</dc:date>
    </item>
  </channel>
</rss>

