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.
Don't miss out on SAS Innovate - Register now for the FREE Livestream!
Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.
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.