<?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: Rounding down by 2 dp in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Rounding-down-by-2-dp/m-p/431856#M106870</link>
    <description>&lt;P&gt;That's not rounding, that's truncation, rounding&amp;nbsp;to 2 decimal places would be 1.00.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Note, please use full words, ie dp=decimal place is my assumption. Not everyone here will know your terminology.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;

x=0.99856;

y=floor(x*100)/100;
y=round(y, 0.01);

put x= y=;

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/130614"&gt;@Adnan_Razaq&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;What function can be used to round down a number by 2 dp, for instance if I have the value of 0.99856 how can I round this down to 0.99?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Many Thanks&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Adnan&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 29 Jan 2018 16:55:27 GMT</pubDate>
    <dc:creator>Reeza</dc:creator>
    <dc:date>2018-01-29T16:55:27Z</dc:date>
    <item>
      <title>Rounding down by 2 dp</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Rounding-down-by-2-dp/m-p/431852#M106866</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What function can be used to round down a number by 2 dp, for instance if I have the value of 0.99856 how can I round this down to 0.99?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Many Thanks&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Adnan&lt;/P&gt;</description>
      <pubDate>Mon, 29 Jan 2018 16:49:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Rounding-down-by-2-dp/m-p/431852#M106866</guid>
      <dc:creator>Adnan_Razaq</dc:creator>
      <dc:date>2018-01-29T16:49:21Z</dc:date>
    </item>
    <item>
      <title>Re: Rounding down by 2 dp</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Rounding-down-by-2-dp/m-p/431856#M106870</link>
      <description>&lt;P&gt;That's not rounding, that's truncation, rounding&amp;nbsp;to 2 decimal places would be 1.00.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Note, please use full words, ie dp=decimal place is my assumption. Not everyone here will know your terminology.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;

x=0.99856;

y=floor(x*100)/100;
y=round(y, 0.01);

put x= y=;

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/130614"&gt;@Adnan_Razaq&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;What function can be used to round down a number by 2 dp, for instance if I have the value of 0.99856 how can I round this down to 0.99?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Many Thanks&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Adnan&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 29 Jan 2018 16:55:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Rounding-down-by-2-dp/m-p/431856#M106870</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-01-29T16:55:27Z</dc:date>
    </item>
    <item>
      <title>Re: Rounding down by 2 dp</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Rounding-down-by-2-dp/m-p/431861#M106874</link>
      <description>&lt;P&gt;Can you have negative numbers, such as:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;-0.98776&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If so, what result would you want to see?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;One possible way to program this (depending on your answer):&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;x = int(100*x) / 100;&lt;/P&gt;</description>
      <pubDate>Mon, 29 Jan 2018 16:59:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Rounding-down-by-2-dp/m-p/431861#M106874</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2018-01-29T16:59:59Z</dc:date>
    </item>
    <item>
      <title>Re: Rounding down by 2 dp</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Rounding-down-by-2-dp/m-p/456871#M115785</link>
      <description>HI Reeza,&lt;BR /&gt;&lt;BR /&gt;Thanks for this solution! Just a question about "y=round(y, 0.01)" as I'm not sure if it's necessary. When I run your code without it, it seems to work fine. Am I missing something? Thanks!&lt;BR /&gt;&lt;BR /&gt;-Joey</description>
      <pubDate>Tue, 24 Apr 2018 14:11:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Rounding-down-by-2-dp/m-p/456871#M115785</guid>
      <dc:creator>jt742</dc:creator>
      <dc:date>2018-04-24T14:11:17Z</dc:date>
    </item>
    <item>
      <title>Re: Rounding down by 2 dp</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Rounding-down-by-2-dp/m-p/457041#M115850</link>
      <description>&lt;P&gt;It depends on what you want. Round will round the variable to the nearest second decimal place in this case. I think this is the same as using 8.2 format to display your data. However, 8.2 only controls the display, the value in the table would still be the actual value, so it depends on what you're trying to do overall.&lt;/P&gt;</description>
      <pubDate>Tue, 24 Apr 2018 20:10:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Rounding-down-by-2-dp/m-p/457041#M115850</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-04-24T20:10:44Z</dc:date>
    </item>
  </channel>
</rss>

