<?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: Proc expand generate weird value in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Proc-expand-generate-weird-value/m-p/901115#M356120</link>
    <description>Numeric Precision issue.&lt;BR /&gt;&lt;BR /&gt;if round(price,1) = round(price_top_&amp;amp;window, 1) then top=1;&lt;BR /&gt;&lt;BR /&gt;Lookup the round function to find the nearest level of precision that you would like to match on.&lt;BR /&gt;&lt;BR /&gt;</description>
    <pubDate>Wed, 01 Nov 2023 16:57:58 GMT</pubDate>
    <dc:creator>Reeza</dc:creator>
    <dc:date>2023-11-01T16:57:58Z</dc:date>
    <item>
      <title>Proc expand generate weird value</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-expand-generate-weird-value/m-p/901111#M356119</link>
      <description>&lt;P&gt;Hi Everyone,&lt;/P&gt;
&lt;P&gt;I use proc expand to get Max value of price. I know for sure that, the max value of price is&amp;nbsp;147212 and proc expand return the same value.&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc expand data=M1 out=M1;
by tic;
convert price=price_top_&amp;amp;window/transformout=(MOVmax &amp;amp;window );
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;However, when I check the condition below, SAS doesn't return top=1 for the record with highest price.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;if price = price_top_&amp;amp;window then top=1;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;After some checking, it turns out that, some how the &lt;CODE class=" language-sas"&gt;price_top_&amp;amp;window&amp;nbsp;&lt;/CODE&gt;is fractional greater than&amp;nbsp;147212.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;When I take Price - &lt;CODE class=" language-sas"&gt;price_top_&amp;amp;window&lt;/CODE&gt;, SAS return value&amp;nbsp;-2.91038E-11, which is&amp;nbsp;-0.0000000000291038&lt;/P&gt;
&lt;P&gt;All of my data are integer.&lt;/P&gt;
&lt;P&gt;I wonder how that happens and how to fix it.&lt;/P&gt;
&lt;P&gt;Thank you,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 01 Nov 2023 16:44:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-expand-generate-weird-value/m-p/901111#M356119</guid>
      <dc:creator>hhchenfx</dc:creator>
      <dc:date>2023-11-01T16:44:13Z</dc:date>
    </item>
    <item>
      <title>Re: Proc expand generate weird value</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-expand-generate-weird-value/m-p/901115#M356120</link>
      <description>Numeric Precision issue.&lt;BR /&gt;&lt;BR /&gt;if round(price,1) = round(price_top_&amp;amp;window, 1) then top=1;&lt;BR /&gt;&lt;BR /&gt;Lookup the round function to find the nearest level of precision that you would like to match on.&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Wed, 01 Nov 2023 16:57:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-expand-generate-weird-value/m-p/901115#M356120</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2023-11-01T16:57:58Z</dc:date>
    </item>
  </channel>
</rss>

