<?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 check for decimal between .45 and .49 and round down? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-check-for-decimal-between-45-and-49-and-round-down/m-p/881023#M348133</link>
    <description>&lt;P&gt;I have an user who wants to round down any values between .45 and .49.&amp;nbsp; The user doesn't want it to automatically round up to .5.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How do I check on decimal points only for any decimal values between .45 and .49 and then round down to .4?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you.&lt;/P&gt;</description>
    <pubDate>Thu, 15 Jun 2023 21:42:19 GMT</pubDate>
    <dc:creator>CurtisER</dc:creator>
    <dc:date>2023-06-15T21:42:19Z</dc:date>
    <item>
      <title>How to check for decimal between .45 and .49 and round down?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-check-for-decimal-between-45-and-49-and-round-down/m-p/881023#M348133</link>
      <description>&lt;P&gt;I have an user who wants to round down any values between .45 and .49.&amp;nbsp; The user doesn't want it to automatically round up to .5.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How do I check on decimal points only for any decimal values between .45 and .49 and then round down to .4?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you.&lt;/P&gt;</description>
      <pubDate>Thu, 15 Jun 2023 21:42:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-check-for-decimal-between-45-and-49-and-round-down/m-p/881023#M348133</guid>
      <dc:creator>CurtisER</dc:creator>
      <dc:date>2023-06-15T21:42:19Z</dc:date>
    </item>
    <item>
      <title>Re: How to check for decimal between .45 and .49 and round down?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-check-for-decimal-between-45-and-49-and-round-down/m-p/881024#M348134</link>
      <description>&lt;P&gt;Probably ten or twelve or 134 ways to do this. Here's one:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;round_down_variable = floor(variable*10)/10;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 15 Jun 2023 21:57:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-check-for-decimal-between-45-and-49-and-round-down/m-p/881024#M348134</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2023-06-15T21:57:55Z</dc:date>
    </item>
    <item>
      <title>Re: How to check for decimal between .45 and .49 and round down?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-check-for-decimal-between-45-and-49-and-round-down/m-p/881095#M348159</link>
      <description>&lt;P&gt;But how do I check for .45 - .49, then round down?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This floor function might work but I don't want to affect any other decimal values that aren't between .45 and .49.&lt;/P&gt;</description>
      <pubDate>Fri, 16 Jun 2023 14:19:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-check-for-decimal-between-45-and-49-and-round-down/m-p/881095#M348159</guid>
      <dc:creator>CurtisER</dc:creator>
      <dc:date>2023-06-16T14:19:13Z</dc:date>
    </item>
    <item>
      <title>Re: How to check for decimal between .45 and .49 and round down?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-check-for-decimal-between-45-and-49-and-round-down/m-p/881105#M348164</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/6183"&gt;@CurtisER&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You could use the IFN function:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
input x @@;
cards;
1.44 2.45 3.49 4.50 5.54 6.55
;

data want;
set have;
r=ifn(.45&amp;lt;=mod(x,1)&amp;lt;=.49, int(x)+.4, round(x,.1));
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;If &lt;FONT face="courier new,courier"&gt;x&lt;/FONT&gt; can also be negative and then the same rule is to be applied, use&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;r=ifn(.45&amp;lt;=abs(mod(x,1))&amp;lt;=.49, int(x)+sign(x)*.4, round(x,.1));&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 16 Jun 2023 14:38:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-check-for-decimal-between-45-and-49-and-round-down/m-p/881105#M348164</guid>
      <dc:creator>FreelanceReinh</dc:creator>
      <dc:date>2023-06-16T14:38:44Z</dc:date>
    </item>
    <item>
      <title>Re: How to check for decimal between .45 and .49 and round down?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-check-for-decimal-between-45-and-49-and-round-down/m-p/881122#M348168</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/6183"&gt;@CurtisER&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;But how do I check for .45 - .49, then round down?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This floor function might work but I don't want to affect any other decimal values that aren't between .45 and .49.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;You can always include an IF statement to handle just the numbers between .45 and .49&lt;/P&gt;</description>
      <pubDate>Fri, 16 Jun 2023 15:12:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-check-for-decimal-between-45-and-49-and-round-down/m-p/881122#M348168</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2023-06-16T15:12:46Z</dc:date>
    </item>
  </channel>
</rss>

