<?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: Postgres Data &amp;quot;Infinity&amp;quot; in Double type is read as funny value in SAS dataset in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Postgres-Data-quot-Infinity-quot-in-Double-type-is-read-as-funny/m-p/561323#M157120</link>
    <description>&lt;P&gt;There is no solution even from SAS technical support on this causing catastrophic error to VA. What I did was using pass thru to convert Infinity to 0. Case Closed.&lt;/P&gt;</description>
    <pubDate>Fri, 24 May 2019 06:37:22 GMT</pubDate>
    <dc:creator>imdickson</dc:creator>
    <dc:date>2019-05-24T06:37:22Z</dc:date>
    <item>
      <title>Postgres Data "Infinity" in Double type is read as funny value in SAS dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Postgres-Data-quot-Infinity-quot-in-Double-type-is-read-as-funny/m-p/560437#M156722</link>
      <description>&lt;P&gt;Hi SAS Communities.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a script that read from Postgres SQL in Datastep. However, upon checking, i notice that there are a few Double Precision columns in PostgresSql are having the value of "Infinity".&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I tried to put the logic:&lt;BR /&gt;if missing(CashValue) or CashValue=. then CashValue=0&lt;/P&gt;&lt;P&gt;but it is not converting it to 0 but remain&amp;nbsp;0.000000E309, which is wrong for sure.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Does anyone have similar issue or can provide advice on this issue?&lt;/P&gt;</description>
      <pubDate>Tue, 21 May 2019 11:08:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Postgres-Data-quot-Infinity-quot-in-Double-type-is-read-as-funny/m-p/560437#M156722</guid>
      <dc:creator>imdickson</dc:creator>
      <dc:date>2019-05-21T11:08:49Z</dc:date>
    </item>
    <item>
      <title>Re: Postgres Data "Infinity" in Double type is read as funny value in SAS dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Postgres-Data-quot-Infinity-quot-in-Double-type-is-read-as-funny/m-p/560672#M156845</link>
      <description>&lt;P&gt;Some things are not clear.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;1.&amp;nbsp;&lt;SPAN&gt;0.000000E309&amp;nbsp; is zero. Is it what you see in SAS? Thats strange.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;2.&amp;nbsp;0.000000E309&amp;nbsp; is&amp;nbsp; not missing, so your test would fail&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;3. SAS show Infinity as special missing value&lt;FONT face="courier new,courier"&gt; I&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;See it by running:&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;&lt;SPAN&gt;data A; A=divide(1,0); run;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;4. What's the value held in&amp;nbsp;Postgres SQL for one of these?&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;5. I had to deal with a bug on Teradata, and worked around it by dividing the value by 1e6 in the pass-through&amp;nbsp;SQL, and multiplying again.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 21 May 2019 22:13:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Postgres-Data-quot-Infinity-quot-in-Double-type-is-read-as-funny/m-p/560672#M156845</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2019-05-21T22:13:36Z</dc:date>
    </item>
    <item>
      <title>Re: Postgres Data "Infinity" in Double type is read as funny value in SAS dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Postgres-Data-quot-Infinity-quot-in-Double-type-is-read-as-funny/m-p/560694#M156856</link>
      <description>&lt;P&gt;So it looks like PosgreSQL is trying to implement IEEE +infinity and/or -infinity floating point values.&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;From the Wiki page&amp;nbsp;&lt;A href="https://en.wikipedia.org/wiki/IEEE_754-1985#Positive_and_negative_infinity" target="_blank"&gt;https://en.wikipedia.org/wiki/IEEE_754-1985#Positive_and_negative_infinity&lt;/A&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;H3&gt;&lt;SPAN class="mw-headline"&gt;Positive and negative infinity&lt;/SPAN&gt;&lt;SPAN class="mw-editsection"&gt;&lt;SPAN class="mw-editsection-bracket"&gt;[&lt;/SPAN&gt;&lt;A title="Edit section: Positive and negative infinity" href="https://en.wikipedia.org/w/index.php?title=IEEE_754-1985&amp;amp;action=edit&amp;amp;section=5" target="_blank"&gt;edit&lt;/A&gt;&lt;SPAN class="mw-editsection-bracket"&gt;]&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/H3&gt;
&lt;P&gt;&lt;A class="mw-redirect" title="Extended real line" href="https://en.wikipedia.org/wiki/Extended_real_line" target="_blank"&gt;Positive and negative infinity&lt;/A&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;are represented thus:&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;DL&gt;
&lt;DD&gt;
&lt;BLOCKQUOTE&gt;&lt;I&gt;sign&lt;/I&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;= 0 for positive infinity, 1 for negative infinity.&lt;/BLOCKQUOTE&gt;
&lt;/DD&gt;
&lt;DD&gt;
&lt;BLOCKQUOTE&gt;&lt;I&gt;biased exponent&lt;/I&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;= all 1 bits.&lt;/BLOCKQUOTE&gt;
&lt;/DD&gt;
&lt;DD&gt;
&lt;BLOCKQUOTE&gt;&lt;I&gt;fraction&lt;/I&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;= all 0 bits.&lt;/BLOCKQUOTE&gt;
&lt;/DD&gt;
&lt;/DL&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Since the floating point number is made up of 1 bit sign, 11 bit exponent and 52 bit fraction then that means value should be&amp;nbsp;&lt;/P&gt;
&lt;P&gt;We see that those should be represented by Hex strings of 7FF000000000000 and FFF0000000000000.&lt;/P&gt;
&lt;P&gt;But those don't display as 0E-309. How ever if we reverse the bits and use&amp;nbsp;0000000000000FFE and&amp;nbsp;0000000000000FFF instead then SAS does display those that way.&amp;nbsp; So it looks like somehow the values are either stored in Posgresql backwards or SAS reverses the bits?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Run a test.&amp;nbsp; Make a little table in the database with a floating point number and store +infinity and -infinity into two records. Pull it into SAS and display the values with the HEX16 format.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 21 May 2019 23:55:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Postgres-Data-quot-Infinity-quot-in-Double-type-is-read-as-funny/m-p/560694#M156856</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2019-05-21T23:55:52Z</dc:date>
    </item>
    <item>
      <title>Re: Postgres Data "Infinity" in Double type is read as funny value in SAS dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Postgres-Data-quot-Infinity-quot-in-Double-type-is-read-as-funny/m-p/560923#M156946</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/63520"&gt;@imdickson&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please show us at least one of those "E309" values in HEX16. format (as has been requested already). Having followed this and &lt;A href="https://communities.sas.com/t5/SAS-Programming/How-do-i-check-if-my-Numeric-column-contains-Character/m-p/560790" target="_blank" rel="noopener"&gt;the other thread&lt;/A&gt;, I'm really curious how they look like. Where do you see those values actually? In PROC PRINT output? Or in a Viewtable window? Isn't it possible to identify one of the affected records either by its observation number or by a suitable (i.e. unique or rare) value of another variable, e.g. an ID? Then you could simply write something like this:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc print data=have(obs=3);
where id= /* put ID value here */;
var CashValue;
format CashValue hex16.;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Another relevant information is your SAS platform: Is it a Windows/Unix system or a mainframe or something else?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;On my Windows machine I found that values from 0000000000000001 to 0000000000000014 (in HEX16. format) are displayed as&amp;nbsp;0.000000E&lt;STRONG&gt;&lt;FONT color="#FF0000"&gt;-&lt;/FONT&gt;&lt;/STRONG&gt;309 (with varying numbers of zeros; note the minus sign) with standard formats such as BEST32. or E32. For larger values (i.e. "...00015" etc.) non-zero digits start to appear (with suitable formats) and these digits make sense mathematically (IEEE-754 standard; the implied bit is &lt;EM&gt;not&lt;/EM&gt; used in these special cases!). Interestingly,&amp;nbsp;8000000000000000 (HEX16.), i.e., kind of "minus zero", is displayed as 0.000000...E-309 as well with the E&lt;EM&gt;w&lt;/EM&gt;. format, but at the same time it's regarded equal to 0.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I've not yet been able to produce a number that is displayed as&amp;nbsp;&lt;SPAN&gt;0.000000&lt;STRONG&gt;&lt;U&gt;E3&lt;/U&gt;09&lt;/STRONG&gt;.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/159"&gt;@Tom&lt;/a&gt;: I think&amp;nbsp;&lt;SPAN&gt;0000000000000FFF&amp;nbsp;and the like are rather "ordinary" small numbers. At least on Windows systems this particular example should be (2**-39 - 2**-51) * 2**-1023 = 2.02...E-320, which is correctly displayed (rounded) as 0.0000000000202E-309 in E20. format.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 22 May 2019 18:20:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Postgres-Data-quot-Infinity-quot-in-Double-type-is-read-as-funny/m-p/560923#M156946</guid>
      <dc:creator>FreelanceReinh</dc:creator>
      <dc:date>2019-05-22T18:20:21Z</dc:date>
    </item>
    <item>
      <title>Re: Postgres Data "Infinity" in Double type is read as funny value in SAS dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Postgres-Data-quot-Infinity-quot-in-Double-type-is-read-as-funny/m-p/561323#M157120</link>
      <description>&lt;P&gt;There is no solution even from SAS technical support on this causing catastrophic error to VA. What I did was using pass thru to convert Infinity to 0. Case Closed.&lt;/P&gt;</description>
      <pubDate>Fri, 24 May 2019 06:37:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Postgres-Data-quot-Infinity-quot-in-Double-type-is-read-as-funny/m-p/561323#M157120</guid>
      <dc:creator>imdickson</dc:creator>
      <dc:date>2019-05-24T06:37:22Z</dc:date>
    </item>
    <item>
      <title>Re: Postgres Data "Infinity" in Double type is read as funny value in SAS dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Postgres-Data-quot-Infinity-quot-in-Double-type-is-read-as-funny/m-p/561325#M157121</link>
      <description>Thanks for keeping us updated. &lt;BR /&gt;</description>
      <pubDate>Fri, 24 May 2019 07:00:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Postgres-Data-quot-Infinity-quot-in-Double-type-is-read-as-funny/m-p/561325#M157121</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2019-05-24T07:00:43Z</dc:date>
    </item>
    <item>
      <title>Re: Postgres Data "Infinity" in Double type is read as funny value in SAS dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Postgres-Data-quot-Infinity-quot-in-Double-type-is-read-as-funny/m-p/566493#M159220</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/63520"&gt;@imdickson&lt;/a&gt;&amp;nbsp;I recall seeing a bug ticket about this the other day. It was for a customer in Asia. Having a NaN value in your data causes a known issue in LASR that has been there a long time. It only recently was seen being triggered by a customer. Both cases I've seen now involved data in LASR being loaded from PostgreSQL to LASR and a +infinity was in the table. It is actively being looked at by R&amp;amp;D.&lt;/P&gt;</description>
      <pubDate>Mon, 17 Jun 2019 04:23:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Postgres-Data-quot-Infinity-quot-in-Double-type-is-read-as-funny/m-p/566493#M159220</guid>
      <dc:creator>SimonDawson</dc:creator>
      <dc:date>2019-06-17T04:23:13Z</dc:date>
    </item>
  </channel>
</rss>

