DATA Step, Macro, Functions and more

Strange with format e8601dt

Accepted Solution Solved
Reply
New Contributor
Posts: 4
Accepted Solution

Strange with format e8601dt

[ Edited ]

when I run code1 and code 2, different values got for variable num2_1. Anyone can help to explain why?  I use SAS EG Version 5.1

 

Code1

data test;

var1 = '2015-01-01';

 var2 = '2015-01-01T10:00';

 

if length(var1)=10 then num1 = input(strip(var1)||'T10:00',e8601dt.);

 

num2_1 = input(strip(var2),e8601dt.);

num2_2 = input(var2,e8601dt.);

run;

 

Code 2

data test;

var1 = '2015-01-01';

 var2 = '2015-01-01T10:00';

 

/*if length(var1)=10 then num1 = input(strip(var1)||'T10:00',e8601dt.);*/

 

num2_1 = input(strip(var2),e8601dt.);

num2_2 = input(var2,e8601dt.);

run;


Accepted Solutions
Solution
‎03-23-2016 01:18 AM
Super User
Posts: 6,933

Re: Strange with format e8601dt

Looks like a bug that was introduced in 9.2 (when those formats were added) and weeded out with 9.4.

---------------------------------------------------------------------------------------------
Maxims of Maximally Efficient SAS Programmers

View solution in original post


All Replies
Super User
Posts: 6,933

Re: Strange with format e8601dt

[ Edited ]

Also happens here with SAS 9.2 on AIX. Contact SAS Technical Support.

 

The if length(var1) = 10 is irrelevant. Just doing the num1= with using the format causes the next expression to return a missing value. I positively think this is a bug with the format (or format handling routine).

 

PS Which SAS version is behind your EG 5.1?

---------------------------------------------------------------------------------------------
Maxims of Maximally Efficient SAS Programmers
New Contributor
Posts: 4

Re: Strange with format e8601dt

Thanks for your reply. SAS 9.3

Super User
Posts: 6,933

Re: Strange with format e8601dt

These formats were introduced with 9.2, so it is not that surprising that there are some yet undiscovered bugs that show themselves in certain peculiar situations.

---------------------------------------------------------------------------------------------
Maxims of Maximally Efficient SAS Programmers
Trusted Advisor
Posts: 1,115

Re: Strange with format e8601dt

This is really strange. But with SAS 9.4 (TS1M2) I cannot replicate the issue.

Frequent Contributor
Posts: 103

Re: Strange with format e8601dt

Neither can I

SAS 9.4 (TS1M2 32-bit)

SAS EG 7.1 HF1 (32-bit)

________________________

- That still only counts as one -

Solution
‎03-23-2016 01:18 AM
Super User
Posts: 6,933

Re: Strange with format e8601dt

Looks like a bug that was introduced in 9.2 (when those formats were added) and weeded out with 9.4.

---------------------------------------------------------------------------------------------
Maxims of Maximally Efficient SAS Programmers
New Contributor
Posts: 4

Re: Strange with format e8601dt

Thanks!
☑ This topic is SOLVED.

Need further help from the community? Please ask a new question.

Discussion stats
  • 7 replies
  • 329 views
  • 0 likes
  • 4 in conversation