<?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: An issue, with hex-variable in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/An-issue-with-hex-variable/m-p/697808#M213327</link>
    <description>&lt;P&gt;pardon, my fault. It is NOT hex, it is masked data. Apologies.&lt;/P&gt;</description>
    <pubDate>Tue, 10 Nov 2020 06:32:00 GMT</pubDate>
    <dc:creator>clauspollas</dc:creator>
    <dc:date>2020-11-10T06:32:00Z</dc:date>
    <item>
      <title>An issue, with hex-variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/An-issue-with-hex-variable/m-p/697533#M213181</link>
      <description>&lt;P&gt;I read some data from a Netezza database, with this nice data, e.g.:&lt;/P&gt;&lt;P&gt;F2F0F2F060F0F860F0F360F0F34BF1F24BF2F94BF9F4F6F7F4F1F3F8F3F7F8F9404040&lt;/P&gt;&lt;P&gt;It is a timestamp (YYYY-MM-DD-HH.MM.SS.999999999999). But SAS can´t read hex-vars longer than 16 chars, as numbers. If I input the above, with $hex70. it returns nonsense.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Netezza keeps timestamps like this:&lt;/P&gt;&lt;P&gt;Min: -63,082,281,600,000,000 (00:00:00, 1/1/0001)&lt;/P&gt;&lt;P class="p"&gt;Max: 252,455,615,999,999,999 (23:59:59.999999, 12/31/9999)&lt;/P&gt;&lt;P class="p"&gt;&amp;nbsp;&lt;/P&gt;&lt;P class="p"&gt;Any suggestions?&lt;/P&gt;</description>
      <pubDate>Mon, 09 Nov 2020 08:32:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/An-issue-with-hex-variable/m-p/697533#M213181</guid>
      <dc:creator>clauspollas</dc:creator>
      <dc:date>2020-11-09T08:32:26Z</dc:date>
    </item>
    <item>
      <title>Re: An issue, with hex-variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/An-issue-with-hex-variable/m-p/697658#M213241</link>
      <description>&lt;P&gt;It may help someone that knows more about Netezza than I do (nothing), to show exactly how you are connecting to the database and how you read data.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;My understanding is that some of the methods involved do "in the background" variable conversion for some of the data types. So the detail may matter.&lt;/P&gt;</description>
      <pubDate>Mon, 09 Nov 2020 16:30:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/An-issue-with-hex-variable/m-p/697658#M213241</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2020-11-09T16:30:23Z</dc:date>
    </item>
    <item>
      <title>Re: An issue, with hex-variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/An-issue-with-hex-variable/m-p/697678#M213254</link>
      <description>&lt;P&gt;Seems like Netezza counts microseconds, and uses a day late in 2000 as day zero:&lt;/P&gt;
&lt;PRE&gt; 73         data _null_;
 74         x1 = 252455615999.999; /* value shortened by 3 digits, as we are reaching the limits of SAS numerical precision */
 75         x2 = datepart(x1);
 76         x3 = "31dec9999"d - x2;
 77         format x1 e8601dt26.6 x2 x3 yymmdd10.;
 78         put _all_;
 79         run;
 
 x1=9960-01-02T23:59:59.998993 x2=9960-01-02 x3=1999-12-30 _ERROR_=0 _N_=1
&lt;/PRE&gt;
&lt;P&gt;There may be a slight shift, depending on which future years are considered as leapyears. You would be better off comparing the current date between SAS and Netezza.&lt;/P&gt;
&lt;P&gt;70 hex characters are suspicious; a 32-byte longint would result in 64 hex characters.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 09 Nov 2020 17:51:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/An-issue-with-hex-variable/m-p/697678#M213254</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2020-11-09T17:51:08Z</dc:date>
    </item>
    <item>
      <title>Re: An issue, with hex-variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/An-issue-with-hex-variable/m-p/697681#M213256</link>
      <description>&lt;P&gt;Looks like an EBCDIC string to me.&lt;/P&gt;
&lt;PRE&gt;523   data test;
524     hexstring='F2F0F2F060F0F860F0F360F0F34BF1F24BF2F94BF9F4F6F7F4F1F3F8F3F7F8F9404040';
525     string  = input(input(hexstring,$hex70.),$EBCDIC35.);
526     put (_all_) (=/);
527   run;


hexstring=F2F0F2F060F0F860F0F360F0F34BF1F24BF2F94BF9F4F6F7F4F1F3F8F3F7F8F9404040
string=2020-08-03-03.12.29.946741383789
NOTE: The data set WORK.TEST has 1 observations and 2 variables.
NOTE: DATA statement used (Total process time):
&lt;/PRE&gt;
&lt;P&gt;So once you have it as ASCII codes instead it should be easy to convert '2020-08-03-03.12.29.946741383789' into a number.&amp;nbsp; Note that you will probably not be able to store it will all of those decimal places on fractions of a second.&lt;/P&gt;
&lt;PRE&gt;542   data test;
543     hexstring='F2F0F2F060F0F860F0F360F0F34BF1F24BF2F94BF9F4F6F7F4F1F3F8F3F7F8F9404040';
544     string  = input(input(hexstring,$hex70.),$EBCDIC35.);
545     date = input(string,yymmdd10.);
546     time = input(substr(string,12),time20.);
547     dt = dhms(date,0,0,time);
548     format date yymmdd10. time time15.5 ;
549     format dt datetime30.5;
550     put (_all_) (=/);
551   run;


hexstring=F2F0F2F060F0F860F0F360F0F34BF1F24BF2F94BF9F4F6F7F4F1F3F8F3F7F8F9404040
string=2020-08-03-03.12.29.946741383789
date=2020-08-03
time=3:12:29.94674
dt=03AUG2020:03:12:29.94674
&lt;/PRE&gt;</description>
      <pubDate>Mon, 09 Nov 2020 18:14:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/An-issue-with-hex-variable/m-p/697681#M213256</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2020-11-09T18:14:22Z</dc:date>
    </item>
    <item>
      <title>Re: An issue, with hex-variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/An-issue-with-hex-variable/m-p/697808#M213327</link>
      <description>&lt;P&gt;pardon, my fault. It is NOT hex, it is masked data. Apologies.&lt;/P&gt;</description>
      <pubDate>Tue, 10 Nov 2020 06:32:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/An-issue-with-hex-variable/m-p/697808#M213327</guid>
      <dc:creator>clauspollas</dc:creator>
      <dc:date>2020-11-10T06:32:00Z</dc:date>
    </item>
    <item>
      <title>Re: An issue, with hex-variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/An-issue-with-hex-variable/m-p/697819#M213331</link>
      <description>&lt;P&gt;Ha, that three 40s should have given me the EBCDIC clue. But it's been quite some time since I pulled my data from a real mainframe.&lt;/P&gt;</description>
      <pubDate>Tue, 10 Nov 2020 08:00:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/An-issue-with-hex-variable/m-p/697819#M213331</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2020-11-10T08:00:21Z</dc:date>
    </item>
  </channel>
</rss>

