<?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: Round giving unexpected result in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Round-giving-unexpected-result/m-p/266526#M52548</link>
    <description>&lt;P&gt;SAS version? OS?&lt;/P&gt;
&lt;P&gt;I couldn't repeat your issue.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;23         data _null_ ;
24         x=0.032949;
25         y=put(round(x,0.0001),7.4);
26         put y=;
27         run;

y=0.0329
NOTE: DATA statement used (Total process time):
      real time           0.00 seconds
      cpu time            0.00 seconds&lt;/PRE&gt;</description>
    <pubDate>Tue, 26 Apr 2016 20:20:19 GMT</pubDate>
    <dc:creator>Haikuo</dc:creator>
    <dc:date>2016-04-26T20:20:19Z</dc:date>
    <item>
      <title>Round giving unexpected result</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Round-giving-unexpected-result/m-p/266522#M52546</link>
      <description>&lt;P&gt;HI,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have a value x=0.032949.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt;if&amp;nbsp;x &amp;gt;= &lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="2"&gt;0.0001&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="2"&gt; then y=put(round(x,&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="2"&gt;0.0001&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="2"&gt;),&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="2"&gt;7.4&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="2"&gt;);&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt;I am getting x=&lt;/FONT&gt;0.017.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Where as I should be getting 0.0329.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Why is this happening?&lt;/P&gt;
&lt;P&gt;How do I fix this?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks,&lt;/P&gt;
&lt;P&gt;Archana&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 26 Apr 2016 20:08:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Round-giving-unexpected-result/m-p/266522#M52546</guid>
      <dc:creator>ArchanaSudhir</dc:creator>
      <dc:date>2016-04-26T20:08:17Z</dc:date>
    </item>
    <item>
      <title>Re: Round giving unexpected result</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Round-giving-unexpected-result/m-p/266526#M52548</link>
      <description>&lt;P&gt;SAS version? OS?&lt;/P&gt;
&lt;P&gt;I couldn't repeat your issue.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;23         data _null_ ;
24         x=0.032949;
25         y=put(round(x,0.0001),7.4);
26         put y=;
27         run;

y=0.0329
NOTE: DATA statement used (Total process time):
      real time           0.00 seconds
      cpu time            0.00 seconds&lt;/PRE&gt;</description>
      <pubDate>Tue, 26 Apr 2016 20:20:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Round-giving-unexpected-result/m-p/266526#M52548</guid>
      <dc:creator>Haikuo</dc:creator>
      <dc:date>2016-04-26T20:20:19Z</dc:date>
    </item>
    <item>
      <title>Re: Round giving unexpected result</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Round-giving-unexpected-result/m-p/266527#M52549</link>
      <description>&lt;P&gt;Following syntax is giving right numbers. Look for&amp;nbsp;Y variable instead of X for rounded numbers&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data _null_;&lt;BR /&gt;x=0.032949;&lt;BR /&gt;if x &amp;gt;= 0.0001 then y=put(round(x,0.0001),7.4);&lt;BR /&gt;put _all_;&lt;BR /&gt;run;&lt;/P&gt;</description>
      <pubDate>Tue, 26 Apr 2016 20:21:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Round-giving-unexpected-result/m-p/266527#M52549</guid>
      <dc:creator>stat_sas</dc:creator>
      <dc:date>2016-04-26T20:21:13Z</dc:date>
    </item>
    <item>
      <title>Re: Round giving unexpected result</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Round-giving-unexpected-result/m-p/266528#M52550</link>
      <description>&lt;P&gt;Post your full code and the log.&lt;/P&gt;
&lt;P&gt;I suspect something is going on with your y variable as I can't reproduce your error with this program:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data junk;
x=0.032949;
if x &amp;gt;= 0.0001 then y=put(round(x,0.0001),7.4);
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;I get the expected value.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And your reason for not using y=put(x,7.4); is exactly what?&lt;/P&gt;</description>
      <pubDate>Tue, 26 Apr 2016 20:25:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Round-giving-unexpected-result/m-p/266528#M52550</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2016-04-26T20:25:10Z</dc:date>
    </item>
  </channel>
</rss>

