<?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: problem with where clause on numeric in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/problem-with-where-clause-on-numeric/m-p/981955#M379211</link>
    <description>&lt;P&gt;The number is to large. See&amp;nbsp;&lt;A href="https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/hostunx/p12zsdbylnn6c2n1i48z7djr6uzo.htm" target="_blank"&gt;https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/hostunx/p12zsdbylnn6c2n1i48z7djr6uzo.htm&lt;/A&gt;&amp;nbsp;for details.&lt;/P&gt;
&lt;P&gt;The largest integer sas can represent exactly is&amp;nbsp;9,007,199,254,740,992.&lt;/P&gt;</description>
    <pubDate>Wed, 14 Jan 2026 14:23:04 GMT</pubDate>
    <dc:creator>andreas_lds</dc:creator>
    <dc:date>2026-01-14T14:23:04Z</dc:date>
    <item>
      <title>problem with where clause on numeric</title>
      <link>https://communities.sas.com/t5/SAS-Programming/problem-with-where-clause-on-numeric/m-p/981954#M379210</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;data have ;
input NUM_ENR_IXN ;
format NUM_ENR_IXN 20. ;
informat NUM_ENR_IXN 20. ;
datalines ;
7572522571591138304
;
run ;&lt;/PRE&gt;
&lt;P&gt;hello&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I create this "have" table . and then, in the where clause of sas i specify&amp;nbsp;NUM_ENR_IXN=7572522571591138304. and the row is retreived.&lt;/P&gt;
&lt;P&gt;But, I try do do the same where in a table that hold 4 milions rows and it retreive no row. yet, i can see this value displayed in the first row.&lt;/P&gt;
&lt;P&gt;thanks in advance for your help&lt;/P&gt;
&lt;P&gt;nass&lt;/P&gt;</description>
      <pubDate>Wed, 14 Jan 2026 14:16:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/problem-with-where-clause-on-numeric/m-p/981954#M379210</guid>
      <dc:creator>Nasser_DRMCP</dc:creator>
      <dc:date>2026-01-14T14:16:19Z</dc:date>
    </item>
    <item>
      <title>Re: problem with where clause on numeric</title>
      <link>https://communities.sas.com/t5/SAS-Programming/problem-with-where-clause-on-numeric/m-p/981955#M379211</link>
      <description>&lt;P&gt;The number is to large. See&amp;nbsp;&lt;A href="https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/hostunx/p12zsdbylnn6c2n1i48z7djr6uzo.htm" target="_blank"&gt;https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/hostunx/p12zsdbylnn6c2n1i48z7djr6uzo.htm&lt;/A&gt;&amp;nbsp;for details.&lt;/P&gt;
&lt;P&gt;The largest integer sas can represent exactly is&amp;nbsp;9,007,199,254,740,992.&lt;/P&gt;</description>
      <pubDate>Wed, 14 Jan 2026 14:23:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/problem-with-where-clause-on-numeric/m-p/981955#M379211</guid>
      <dc:creator>andreas_lds</dc:creator>
      <dc:date>2026-01-14T14:23:04Z</dc:date>
    </item>
    <item>
      <title>Re: problem with where clause on numeric</title>
      <link>https://communities.sas.com/t5/SAS-Programming/problem-with-where-clause-on-numeric/m-p/981956#M379212</link>
      <description>&lt;P&gt;Can you confirm that the variable is numeric in your real data set by running a PROC CONTENTS? Can you send your log? Because of floating point representation, SAS can only guarantee precision up to 15, and sometimes 16, significant digits. It may be better to read this variable in as character and then use quotes around the value in your WHERE clause.&lt;/P&gt;</description>
      <pubDate>Wed, 14 Jan 2026 14:25:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/problem-with-where-clause-on-numeric/m-p/981956#M379212</guid>
      <dc:creator>Kathryn_SAS</dc:creator>
      <dc:date>2026-01-14T14:25:51Z</dc:date>
    </item>
    <item>
      <title>Re: problem with where clause on numeric</title>
      <link>https://communities.sas.com/t5/SAS-Programming/problem-with-where-clause-on-numeric/m-p/981957#M379213</link>
      <description>&lt;P&gt;i confirm that this is a numeric. i have no log.&lt;/P&gt;
&lt;P&gt;i notice that the value appaers by doing a where cluase like&amp;nbsp; NUM_ENR_IXN&amp;gt;=7572522571591138000 and NUM_ENR_IXN &amp;lt;= 7572522571591138999&lt;/P&gt;</description>
      <pubDate>Wed, 14 Jan 2026 14:32:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/problem-with-where-clause-on-numeric/m-p/981957#M379213</guid>
      <dc:creator>Nasser_DRMCP</dc:creator>
      <dc:date>2026-01-14T14:32:53Z</dc:date>
    </item>
    <item>
      <title>Re: problem with where clause on numeric</title>
      <link>https://communities.sas.com/t5/SAS-Programming/problem-with-where-clause-on-numeric/m-p/981980#M379218</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/147725"&gt;@Nasser_DRMCP&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/147725"&gt;@Nasser_DRMCP&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;But, I try do do the same where in a table that hold 4 milions rows and it retreive no row. yet, i can see this value displayed in the first row.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;A numeric value like 7572522571591139328 (an integer with 19 decimal digits) in a SAS dataset has a &lt;EM&gt;high risk&lt;/EM&gt; of being the result of &lt;EM&gt;unintended rounding&lt;/EM&gt; in the binary system. Note that this number is divisible by 2**14=16384, hence it has 14 trailing zeros in the binary number system.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I suspect that those four million "rows" of data that you mention are not an ordinary SAS dataset (under a Windows or Unix OS), but a table, e.g., in CAS or from an external database where special data types such as &lt;A href="https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/ds2ref/p0e8igzv6k1mvqn1a2a5gbi7dsnx.htm" target="_blank" rel="noopener"&gt;BIGINT&lt;/A&gt; are available. Those are supported by DS2 and FedSQL, but not through the SAS BASE driver. This could explain why a WHERE clause using the &lt;EM&gt;rounded&lt;/EM&gt; value does not retrieve any rows.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Working with numeric values so close even to the limits of the BIGINT data type is risky, as your example shows. So, unless you ensure that they are handled only by suitable tools (e.g. using explicit pass-through to connect to a data source supporting BIGINT), it might be safer to store them as character values (as&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13770"&gt;@Kathryn_SAS&lt;/a&gt;&amp;nbsp;has suggested) or maybe to split them into smaller numeric values. Of course, both these options require some extra considerations.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I would not recommend workarounds that may work in some cases, but not in others. Note that, in an ordinary Windows SAS DATA step, the condition&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/147725"&gt;@Nasser_DRMCP&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;NUM_ENR_IXN&amp;gt;=7572522571591138000 and NUM_ENR_IXN &amp;lt;= 7572522571591138999&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;would be met by numbers that are actually not contained in the specified range:&lt;/P&gt;
&lt;PRE&gt;262   data _null_;
263   if 75725225715911&lt;STRONG&gt;38&lt;/STRONG&gt;000 &amp;lt;= 75725225715911&lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;3&lt;/STRONG&gt;&lt;STRONG&gt;7&lt;/STRONG&gt;&lt;/FONT&gt;280 &amp;lt;= 75725225715911&lt;STRONG&gt;38&lt;/STRONG&gt;999 then put 'Surprise 1';
264   if 75725225715911&lt;STRONG&gt;38&lt;/STRONG&gt;000 &amp;lt;= 75725225715911&lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;40&lt;/STRONG&gt;&lt;/FONT&gt;352 &amp;lt;= 75725225715911&lt;STRONG&gt;38&lt;/STRONG&gt;999 then put 'Surprise 2';
265   run;

Surprise 1
Surprise 2
&lt;/PRE&gt;
&lt;P&gt;Which is particularly surprising, as the IF conditions above should not be met even if mathematical rounding in the binary system (to 52 mantissa bits) is taken into account.&lt;/P&gt;</description>
      <pubDate>Wed, 14 Jan 2026 18:51:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/problem-with-where-clause-on-numeric/m-p/981980#M379218</guid>
      <dc:creator>FreelanceReinh</dc:creator>
      <dc:date>2026-01-14T18:51:44Z</dc:date>
    </item>
  </channel>
</rss>

