<?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: SAS 9.3 bug? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/SAS-9-3-bug/m-p/317336#M69470</link>
    <description>&lt;P&gt;I think it's a SAS 9.3 bug. Adding seconds ':00' works the same way as increasing date1 length to $19 - input is performed correctly (as expected). Must be some kind of memory optimisation bug - because changing value of date2 to '2' also lets to input date1 without an error.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Just noticed, that if I initialize date2 before date1, the input works as expected.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 07 Dec 2016 15:35:59 GMT</pubDate>
    <dc:creator>TD</dc:creator>
    <dc:date>2016-12-07T15:35:59Z</dc:date>
    <item>
      <title>SAS 9.3 bug?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-9-3-bug/m-p/317323#M69463</link>
      <description>&lt;P&gt;Hi&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'm experiencing weird SAS behavior:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;data a;&lt;BR /&gt;/*&amp;nbsp;&amp;nbsp;&amp;nbsp; uncomment for input to work in the next data step*/&lt;BR /&gt;/*&amp;nbsp;&amp;nbsp;&amp;nbsp; length date1 $20; */&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; date1 = '2015-10-26T23:59';&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; date2 = '2015-10-26';&lt;BR /&gt;run;&lt;BR /&gt;&lt;BR /&gt;data b;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; set a;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; not_related = trim(left(strip(date2)))||'T23:59';&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; dt = input(date1, e8601dt.);&lt;BR /&gt;run;&lt;BR /&gt;&lt;BR /&gt;
&lt;/PRE&gt;
&lt;P&gt;the second datastep produces a note that input has invalid argument. However, if in first datastep I set date1 length to $20, then the second step has no problem to run and input date/time.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Tested on SAS 9.3 TS Level 1M2 X64_ES08R2.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Anyone else seen this before?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Wed, 07 Dec 2016 15:14:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-9-3-bug/m-p/317323#M69463</guid>
      <dc:creator>TD</dc:creator>
      <dc:date>2016-12-07T15:14:09Z</dc:date>
    </item>
    <item>
      <title>Re: SAS 9.3 bug?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-9-3-bug/m-p/317327#M69467</link>
      <description>&lt;P&gt;I don't get this, using 9.4:&lt;/P&gt;
&lt;P&gt;299 data a;&lt;BR /&gt;300 /* uncomment for input to work in the next data step*/&lt;BR /&gt;301 /* length date1 $20; */&lt;BR /&gt;302 date1 = '2015-10-26T23:59';&lt;BR /&gt;303 date2 = '2015-10-26';&lt;BR /&gt;304 run;&lt;/P&gt;
&lt;P&gt;NOTE: The data set WORK.A has 1 observations and 2 variables.&lt;BR /&gt;NOTE: DATA statement used (Total process time):&lt;BR /&gt; real time 0.01 seconds&lt;BR /&gt; cpu time 0.01 seconds&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;305&lt;BR /&gt;306 data b;&lt;BR /&gt;307 set a;&lt;BR /&gt;308 not_related = trim(left(strip(date2)))||'T23:59';&lt;BR /&gt;309 dt = input(date1, e8601dt.);&lt;BR /&gt;310 run;&lt;/P&gt;
&lt;P&gt;NOTE: There were 1 observations read from the data set WORK.A.&lt;BR /&gt;NOTE: The data set WORK.B has 1 observations and 4 variables.&lt;BR /&gt;NOTE: DATA statement used (Total process time):&lt;BR /&gt; real time 0.04 seconds&lt;BR /&gt; cpu time 0.00 seconds&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;What does your log look like?&lt;/P&gt;</description>
      <pubDate>Wed, 07 Dec 2016 15:20:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-9-3-bug/m-p/317327#M69467</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2016-12-07T15:20:33Z</dc:date>
    </item>
    <item>
      <title>Re: SAS 9.3 bug?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-9-3-bug/m-p/317329#M69468</link>
      <description>&lt;PRE&gt;1    data a;
2    /*    uncomment for input to work in the next data step*/
3    /*    length date1 $20; */
4        date1 = '2015-10-26T23:59';
5        date2 = '2015-10-26';
6    run;

NOTE: The data set WORK.A has 1 observations and 2 variables.
NOTE: DATA statement used (Total process time):
      real time           0.01 seconds
      user cpu time       0.00 seconds
      system cpu time     0.01 seconds
7
8    data b;
9        set a;
10       dt = input(date1, e8601dt.);
11   run;

NOTE: Invalid argument to function INPUT at line 10 column 10.
date1=2015-10-26T23:59 date2=2015-10-26 dt=. _ERROR_=1 _N_=1
NOTE: Mathematical operations could not be performed at the following places. The results of the
      operations have been set to missing values.
      Each place is given by: (Number of times) at (Line):(Column).
      1 at 10:10
NOTE: There were 1 observations read from the data set WORK.A.
NOTE: The data set WORK.B has 1 observations and 3 variables.
NOTE: DATA statement used (Total process time):
      real time           0.01 seconds
      user cpu time       0.00 seconds
      system cpu time     0.01 seconds

&lt;/PRE&gt;</description>
      <pubDate>Wed, 07 Dec 2016 15:22:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-9-3-bug/m-p/317329#M69468</guid>
      <dc:creator>TD</dc:creator>
      <dc:date>2016-12-07T15:22:38Z</dc:date>
    </item>
    <item>
      <title>Re: SAS 9.3 bug?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-9-3-bug/m-p/317332#M69469</link>
      <description>&lt;P&gt;Well, I don't have 9.3 to hand and can't find a page on changes, but it may be that in 9.4 they relaxed the requirements on the string. &amp;nbsp;Does adding the seconds part change this, I remember I always used to have to add ":00" to the end to get the format to work for me.&lt;/P&gt;</description>
      <pubDate>Wed, 07 Dec 2016 15:29:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-9-3-bug/m-p/317332#M69469</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2016-12-07T15:29:36Z</dc:date>
    </item>
    <item>
      <title>Re: SAS 9.3 bug?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-9-3-bug/m-p/317336#M69470</link>
      <description>&lt;P&gt;I think it's a SAS 9.3 bug. Adding seconds ':00' works the same way as increasing date1 length to $19 - input is performed correctly (as expected). Must be some kind of memory optimisation bug - because changing value of date2 to '2' also lets to input date1 without an error.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Just noticed, that if I initialize date2 before date1, the input works as expected.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 07 Dec 2016 15:35:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-9-3-bug/m-p/317336#M69470</guid>
      <dc:creator>TD</dc:creator>
      <dc:date>2016-12-07T15:35:59Z</dc:date>
    </item>
    <item>
      <title>Re: SAS 9.3 bug?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-9-3-bug/m-p/317337#M69471</link>
      <description>&lt;P&gt;When I read the documentation for E8601dt informat is says default length is 19 and minimum length is 19, ie. E8601dt19. max length 26.&lt;/P&gt;
&lt;P&gt;When you use&lt;/P&gt;
&lt;P&gt;&lt;FONT face="SAS Monospace" size="2"&gt;date1 = &lt;/FONT&gt;&lt;FONT color="#800080" face="SAS Monospace" size="2"&gt;'2015-10-26T23:59' &lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#000000" face="SAS Monospace" size="2"&gt;the length of date1 is 16, which is too short generating the error.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#000000" face="SAS Monospace" size="2"&gt;This doesn't generate the error.&lt;/FONT&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;FONT color="#000000" face="SAS Monospace" size="2"&gt;data a;
/*    uncomment for input to work in the next data step*/
/*    length date1 $20; */
    date1 = '2015-10-26T23:59:00';
    date2 = '2015-10-26';
run;

data b;
    set a;
    not_related = trim(left(strip(date2)))||'T23:59';
    dt = input(date1, e8601dt.);
run;&lt;/FONT&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;FONT color="#000000" face="SAS Monospace" size="2"&gt;Neither does:&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;FONT color="#000000" face="SAS Monospace" size="2"&gt;&lt;CODE class=" language-sas"&gt;data a;
/*    uncomment for input to work in the next data step*/
/*    length date1 $20; */
    date1 = '2015-10-26T23:59   ';
    date2 = '2015-10-26';
run;

data b;
    set a;
    not_related = trim(left(strip(date2)))||'T23:59';
    dt = input(date1, e8601dt.);
run;
&lt;/CODE&gt;&lt;/FONT&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;FONT color="#000000" face="SAS Monospace" size="2"&gt;The Input and informat are apparently checking on the length propery&amp;nbsp;of the variable not the number of assigned characters.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 07 Dec 2016 15:40:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-9-3-bug/m-p/317337#M69471</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2016-12-07T15:40:16Z</dc:date>
    </item>
    <item>
      <title>Re: SAS 9.3 bug?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-9-3-bug/m-p/317517#M69535</link>
      <description>&lt;P&gt;does not seem a consistent check: there's no problem to input a value from variable with length of $16 when the date2 is initialized first in the first data step.&lt;/P&gt;</description>
      <pubDate>Thu, 08 Dec 2016 08:17:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-9-3-bug/m-p/317517#M69535</guid>
      <dc:creator>TD</dc:creator>
      <dc:date>2016-12-08T08:17:53Z</dc:date>
    </item>
    <item>
      <title>Re: SAS 9.3 bug?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-9-3-bug/m-p/317653#M69573</link>
      <description>&lt;P&gt;This is definitely odd:&lt;/P&gt;
&lt;PRE&gt;data a;
    length date1 date2 $ 16 ; 
    date1 = '2015-10-26T23:59:00';
    date2 = '2015-10-26T23:59';
run;

data b;
    set a;
    dt1 = input(date1, e8601dt.);
    dt2 = input(date2, e8601dt.);
run;&lt;/PRE&gt;
&lt;P&gt;It may be time to contact Tech support as this particular bit might be an actual bug.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But I would suggest if possible sticking to declaring any variable like this with a length at least 19 and not relying on implied length assignments. Explicit lengths are better programming practice.&lt;/P&gt;</description>
      <pubDate>Thu, 08 Dec 2016 16:59:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-9-3-bug/m-p/317653#M69573</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2016-12-08T16:59:12Z</dc:date>
    </item>
    <item>
      <title>Re: SAS 9.3 bug?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-9-3-bug/m-p/317678#M69577</link>
      <description>&lt;P&gt;Its a known bug since SAS 9.2. What happening here is width of E8601DT must be 19 but the width&lt;BR /&gt;of value is only 16, so extra 3 characters are taken from the followed values.&lt;/P&gt;&lt;P&gt;&lt;IMG title="Capture.PNG" alt="Capture.PNG" src="https://communities.sas.com/t5/image/serverpage/image-id/6291i790D77D7978EDF4F/image-size/original?v=v2&amp;amp;px=-1" border="0" /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here in the example it is trying to take the values '201' as seconds i.e attempting to takes&lt;BR /&gt;values as ":ss". As 201 is not in the format as ":ss" it throwed an error as invalid argument.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This issue has been fixed in SAS 9.4&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;FYI: &lt;A href="http://support.sas.com/kb/43/743.html" target="_blank"&gt;http://support.sas.com/kb/43/743.html&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 08 Dec 2016 19:51:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-9-3-bug/m-p/317678#M69577</guid>
      <dc:creator>SuryaKiran</dc:creator>
      <dc:date>2016-12-08T19:51:21Z</dc:date>
    </item>
  </channel>
</rss>

