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;
Looks like a bug that was introduced in 9.2 (when those formats were added) and weeded out with 9.4.
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?
Thanks for your reply. SAS 9.3
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.
This is really strange. But with SAS 9.4 (TS1M2) I cannot replicate the issue.
Neither can I
SAS 9.4 (TS1M2 32-bit)
SAS EG 7.1 HF1 (32-bit)
- Cheers -
Looks like a bug that was introduced in 9.2 (when those formats were added) and weeded out with 9.4.
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.