<?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 Formatting numbers. in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Formatting-numbers/m-p/440987#M110260</link>
    <description>&lt;P&gt;&lt;SPAN&gt;Perhaps it quite simple, but I need to easily convert my data in multiples of 100 only like 619 should be 600, 754 should be 700,1238976 should be 1238900. Any easy fix? Thanks a lot.&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Wed, 28 Feb 2018 18:42:40 GMT</pubDate>
    <dc:creator>thepushkarsingh</dc:creator>
    <dc:date>2018-02-28T18:42:40Z</dc:date>
    <item>
      <title>Formatting numbers.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Formatting-numbers/m-p/440987#M110260</link>
      <description>&lt;P&gt;&lt;SPAN&gt;Perhaps it quite simple, but I need to easily convert my data in multiples of 100 only like 619 should be 600, 754 should be 700,1238976 should be 1238900. Any easy fix? Thanks a lot.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 28 Feb 2018 18:42:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Formatting-numbers/m-p/440987#M110260</guid>
      <dc:creator>thepushkarsingh</dc:creator>
      <dc:date>2018-02-28T18:42:40Z</dc:date>
    </item>
    <item>
      <title>Re: Formatting numbers.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Formatting-numbers/m-p/440988#M110261</link>
      <description>&lt;P&gt;Is the round down what you want? or just round?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If it's ROUND, then use the ROUND() Function with 100 as the second parameter.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If it's floor, you need to divide by 100, floor it, and then multiply by 100.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;answer1 = round(original, 100);
answer2 = floor(original/100)*100;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 28 Feb 2018 18:46:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Formatting-numbers/m-p/440988#M110261</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-02-28T18:46:05Z</dc:date>
    </item>
    <item>
      <title>Re: Formatting numbers.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Formatting-numbers/m-p/441064#M110282</link>
      <description>&lt;P&gt;I have small doubt on the&lt;/P&gt;&lt;PRE class=" language-sas"&gt;&lt;CODE class="  language-sas"&gt;answer1 &lt;SPAN class="token operator"&gt;=&lt;/SPAN&gt; &lt;SPAN class="token function"&gt;round&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;(619&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;,&lt;/SPAN&gt; &lt;SPAN class="token number"&gt;100&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;)&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;BR /&gt;answer1=600;&lt;BR /&gt;&lt;BR /&gt;how we are getting 600 can someone explain it...&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;can you please explain it..&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;I have understand in this method&lt;BR /&gt;x=round(223.456,.3);&lt;BR /&gt;&lt;BR /&gt;Result:&lt;BR /&gt;&lt;BR /&gt;x=223.5&lt;BR /&gt;&lt;BR /&gt;In the above I have understand that &lt;BR /&gt;&lt;BR /&gt;first step: 223.456*0.3=67.0368&lt;BR /&gt;second step :round(67.0368)=67.368&lt;BR /&gt;third step : 67.368/0.3=223.5&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 28 Feb 2018 22:59:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Formatting-numbers/m-p/441064#M110282</guid>
      <dc:creator>rajeshalwayswel</dc:creator>
      <dc:date>2018-02-28T22:59:44Z</dc:date>
    </item>
    <item>
      <title>Re: Formatting numbers.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Formatting-numbers/m-p/441096#M110294</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/174522"&gt;@rajeshalwayswel&lt;/a&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;&lt;SPAN&gt;Rounds the first argument to the &lt;STRONG&gt;nearest multiple of the second argument,&lt;/STRONG&gt; or &lt;STRONG&gt;to the nearest integer&lt;/STRONG&gt; when the second argument is omitted.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;So in 619, the nearest 100 is 600 and 700. Because 600 is closer, it's rounded to 600.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Your interpretation/logic appears incorrect - run the code.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;first step: 223.456*0.3=67.0368&lt;BR /&gt;&lt;STRONG&gt;second step :round(67.0368)=67.368 -&amp;gt; This would result in 67, not 67.368.&amp;nbsp;&lt;/STRONG&gt;&lt;BR /&gt;third step : 67.368/0.3=223.5&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;My interpretation was always, figure out how many exact values of the second parameter fit in and then round up or down as&amp;nbsp;necessary.&amp;nbsp;&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;&lt;SPAN&gt;The logic in my head is, assuming ROUND(P1, P2) is equivalent to:&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Value = round(P1/P2,1) * P2 ;&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;At least for positive values. Here's some demo code that can help illustrate this.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data demo;
 x=round(223.456, .3);
 y=223.456/0.3;
 z=round(y, 1);
 w=z*0.3;
 x1=round(67.0368);
 test=round(223.456/0.3)*0.3;
 test2=round(619, 100);
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/174522"&gt;@rajeshalwayswel&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;I have small doubt on the&lt;/P&gt;
&lt;PRE class=" language-sas"&gt;&lt;CODE class="  language-sas"&gt;answer1 &lt;SPAN class="token operator"&gt;=&lt;/SPAN&gt; &lt;SPAN class="token function"&gt;round&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;(619&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;,&lt;/SPAN&gt; &lt;SPAN class="token number"&gt;100&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;)&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;BR /&gt;answer1=600;&lt;BR /&gt;&lt;BR /&gt;how we are getting 600 can someone explain it...&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;can you please explain it..&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;I have understand in this method&lt;BR /&gt;x=round(223.456,.3);&lt;BR /&gt;&lt;BR /&gt;Result:&lt;BR /&gt;&lt;BR /&gt;x=223.5&lt;BR /&gt;&lt;BR /&gt;In the above I have understand that &lt;BR /&gt;&lt;BR /&gt;first step: 223.456*0.3=67.0368&lt;BR /&gt;second step :round(67.0368)=67.368&lt;BR /&gt;third step : 67.368/0.3=223.5&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 01 Mar 2018 02:36:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Formatting-numbers/m-p/441096#M110294</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-03-01T02:36:54Z</dc:date>
    </item>
    <item>
      <title>Re: Formatting numbers.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Formatting-numbers/m-p/441302#M110378</link>
      <description>&lt;P&gt;Thank you.. It very clear..&lt;/P&gt;</description>
      <pubDate>Thu, 01 Mar 2018 17:36:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Formatting-numbers/m-p/441302#M110378</guid>
      <dc:creator>rajeshalwayswel</dc:creator>
      <dc:date>2018-03-01T17:36:34Z</dc:date>
    </item>
  </channel>
</rss>

