<?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: Change decimal to whole number in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Change-decimal-to-whole-number/m-p/787025#M251381</link>
    <description>How do you know which ones are not correct?&lt;BR /&gt;Assuming all are less than one you could do something like:&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;if variable&amp;lt;1 then variable=variable*100;&lt;BR /&gt;&lt;BR /&gt;</description>
    <pubDate>Tue, 21 Dec 2021 22:44:16 GMT</pubDate>
    <dc:creator>Reeza</dc:creator>
    <dc:date>2021-12-21T22:44:16Z</dc:date>
    <item>
      <title>Change decimal to whole number</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Change-decimal-to-whole-number/m-p/787023#M251379</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have data with whole numbers values (34, 78...) in all hospitals except for one who has the numbers as (16%, 65% which ended in having .16 and .65 in the final data set...). Is there a way to change those values to whole numbers such as 16 and 65?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you&lt;/P&gt;</description>
      <pubDate>Tue, 21 Dec 2021 22:39:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Change-decimal-to-whole-number/m-p/787023#M251379</guid>
      <dc:creator>mayasak</dc:creator>
      <dc:date>2021-12-21T22:39:17Z</dc:date>
    </item>
    <item>
      <title>Re: Change decimal to whole number</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Change-decimal-to-whole-number/m-p/787025#M251381</link>
      <description>How do you know which ones are not correct?&lt;BR /&gt;Assuming all are less than one you could do something like:&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;if variable&amp;lt;1 then variable=variable*100;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Tue, 21 Dec 2021 22:44:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Change-decimal-to-whole-number/m-p/787025#M251381</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2021-12-21T22:44:16Z</dc:date>
    </item>
    <item>
      <title>Re: Change decimal to whole number</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Change-decimal-to-whole-number/m-p/787029#M251384</link>
      <description>It's only one hospital so I'm wondering if I can apply that for hospital = 'abc' such as&lt;BR /&gt;data new;&lt;BR /&gt;set test;&lt;BR /&gt;if variable&amp;lt;1 then variable=variable*100;&lt;BR /&gt;where hospital = 'abc';&lt;BR /&gt;run;</description>
      <pubDate>Tue, 21 Dec 2021 23:45:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Change-decimal-to-whole-number/m-p/787029#M251384</guid>
      <dc:creator>mayasak</dc:creator>
      <dc:date>2021-12-21T23:45:01Z</dc:date>
    </item>
    <item>
      <title>Re: Change decimal to whole number</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Change-decimal-to-whole-number/m-p/787035#M251389</link>
      <description>&lt;P&gt;Even though you wrote the WHERE statement after the IF statement is will actually apply to the data as it is read.&amp;nbsp;So your resulting dataset will only have the data from the one hospital.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you did not intend to subset the data then instead include the extra test in the IF condition.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data new;
  set test;
  if variable&amp;lt;1 and hospital = 'abc' then variable=variable*100;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 22 Dec 2021 00:41:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Change-decimal-to-whole-number/m-p/787035#M251389</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2021-12-22T00:41:10Z</dc:date>
    </item>
    <item>
      <title>Re: Change decimal to whole number</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Change-decimal-to-whole-number/m-p/787076#M251408</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/47035"&gt;@mayasak&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;if variable&amp;lt;1 then variable=variable*100;&lt;BR /&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/47035"&gt;@mayasak&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You may be lucky with your data, but in general I would use the ROUND function (or the INT function in your particular case) to ensure that the resulting numbers are &lt;EM&gt;exactly&lt;/EM&gt; what you would expect:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;... then variable=&lt;FONT color="#3366FF"&gt;&lt;STRONG&gt;round(&lt;/STRONG&gt;&lt;/FONT&gt;variable*100&lt;FONT color="#3366FF"&gt;&lt;STRONG&gt;,1e-9)&lt;/STRONG&gt;&lt;/FONT&gt;;&lt;/PRE&gt;
&lt;P&gt;Thus you avoid surprises like in this log (obtained with SAS 9.4M5 on Windows)&lt;FONT face="helvetica"&gt;:&lt;/FONT&gt;&lt;/P&gt;
&lt;PRE&gt;77   data _null_;
78   if 0.14*100~=14 &amp;amp; 0.29*100&amp;lt;29 &amp;amp; 0.55*100&amp;gt;55 then put 'Surprised?';
79   run;

Surprised?
NOTE: DATA statement used (Total process time):&lt;/PRE&gt;</description>
      <pubDate>Wed, 22 Dec 2021 10:07:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Change-decimal-to-whole-number/m-p/787076#M251408</guid>
      <dc:creator>FreelanceReinh</dc:creator>
      <dc:date>2021-12-22T10:07:05Z</dc:date>
    </item>
  </channel>
</rss>

