<?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: Trying round up to 10/20/30/40 /50 etc in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Trying-round-up-to-10-20-30-40-50-etc/m-p/806788#M317939</link>
    <description>&lt;P&gt;Brilliant!&amp;nbsp; &amp;nbsp;I did not, only change i had to make was doing 8/2 instead of 10, b/c the 10 brought (in my example 40 to the value of 50) but the 8 worked for say 41-44!&lt;/P&gt;&lt;P&gt;Thank you!!&lt;/P&gt;</description>
    <pubDate>Fri, 08 Apr 2022 14:33:46 GMT</pubDate>
    <dc:creator>RZ123</dc:creator>
    <dc:date>2022-04-08T14:33:46Z</dc:date>
    <item>
      <title>Trying round up to 10/20/30/40 /50 etc</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Trying-round-up-to-10-20-30-40-50-etc/m-p/806770#M317931</link>
      <description>&lt;P&gt;I am trying to round "UP" my numbers in a dynamic list to the nearest 10&lt;/P&gt;&lt;P&gt;so for example if the number of the list is 41, I need the function to return 50 as that value&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have tried this&lt;/P&gt;&lt;P&gt;data want;&lt;/P&gt;&lt;P&gt;set dataset;&lt;/P&gt;&lt;P&gt;round_multiple = round(var, 10);&lt;/P&gt;&lt;P&gt;round_ceil = ceil(var);&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;the round multiple only rounds up if 5 or greater and rounds down 4 and lower&lt;/P&gt;&lt;P&gt;the ceil does not allow integer increases so it doesn't seem to work.&lt;/P&gt;&lt;P&gt;any thoughts on how to get this to work is much appreciated.&lt;/P&gt;&lt;P&gt;thanks!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 08 Apr 2022 13:46:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Trying-round-up-to-10-20-30-40-50-etc/m-p/806770#M317931</guid>
      <dc:creator>RZ123</dc:creator>
      <dc:date>2022-04-08T13:46:03Z</dc:date>
    </item>
    <item>
      <title>Re: Trying round up to 10/20/30/40 /50 etc</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Trying-round-up-to-10-20-30-40-50-etc/m-p/806777#M317935</link>
      <description>&lt;P&gt;Did you try adding 5?&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;round_up = round( have + (10/2) , 10 );&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 08 Apr 2022 13:58:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Trying-round-up-to-10-20-30-40-50-etc/m-p/806777#M317935</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2022-04-08T13:58:59Z</dc:date>
    </item>
    <item>
      <title>Re: Trying round up to 10/20/30/40 /50 etc</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Trying-round-up-to-10-20-30-40-50-etc/m-p/806788#M317939</link>
      <description>&lt;P&gt;Brilliant!&amp;nbsp; &amp;nbsp;I did not, only change i had to make was doing 8/2 instead of 10, b/c the 10 brought (in my example 40 to the value of 50) but the 8 worked for say 41-44!&lt;/P&gt;&lt;P&gt;Thank you!!&lt;/P&gt;</description>
      <pubDate>Fri, 08 Apr 2022 14:33:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Trying-round-up-to-10-20-30-40-50-etc/m-p/806788#M317939</guid>
      <dc:creator>RZ123</dc:creator>
      <dc:date>2022-04-08T14:33:46Z</dc:date>
    </item>
    <item>
      <title>Re: Trying round up to 10/20/30/40 /50 etc</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Trying-round-up-to-10-20-30-40-50-etc/m-p/806808#M317953</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/422368"&gt;@RZ123&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I would not recommend this solution of using 8/2 = 4 to do the rounding, as I think it produces incorrect results (unless your data will only be integers). In the case where your data is not integers, the value 40.5 will round to 40, but that's not (if I am understanding you properly) rounding up.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;On the other hand, this forces 40 to round to 40, and 40.5 to round to 50, and this makes more sense in general anyway.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;if (have/10)=floor(have/10) then round_up=have; /* If have is an exact multiple of 10 */
else round_up = round( have + (10/2) , 10 );&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 08 Apr 2022 16:58:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Trying-round-up-to-10-20-30-40-50-etc/m-p/806808#M317953</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2022-04-08T16:58:00Z</dc:date>
    </item>
    <item>
      <title>Re: Trying round up to 10/20/30/40 /50 etc</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Trying-round-up-to-10-20-30-40-50-etc/m-p/806846#M317971</link>
      <description>&lt;P&gt;Yes thank you, This is probably more than you would like to know but in my example they are only whole numbers, basically it's part of a bigger formula that selects the TOP 10% of a dynamic file Month over Month&amp;nbsp; &amp;nbsp;the count is created Per line and the request was 10% of the total, however, if there are 41 (as my example) they want to base the top 10 on 50 rather than 40 (since 4.1 is the 10% of 41, however we can not give .1% of an account to QA)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;That being said, I am looking into using what you're saying as I may in the future come up with a situation where they are not whole numbers and if it's constructed better for multi-purpose it makes sense to use yours even though the one above worked. (plus im lazy and like to steal things I did in the past for any future use)&lt;/P&gt;</description>
      <pubDate>Fri, 08 Apr 2022 20:36:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Trying-round-up-to-10-20-30-40-50-etc/m-p/806846#M317971</guid>
      <dc:creator>RZ123</dc:creator>
      <dc:date>2022-04-08T20:36:42Z</dc:date>
    </item>
  </channel>
</rss>

