BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
sasmilly
Calcite | Level 5

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;

1 ACCEPTED SOLUTION
7 REPLIES 7
Kurt_Bremser
Super User

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?

sasmilly
Calcite | Level 5

Thanks for your reply. SAS 9.3

Kurt_Bremser
Super User

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.

FreelanceReinh
Jade | Level 19

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

Oligolas
Barite | Level 11

Neither can I

SAS 9.4 (TS1M2 32-bit)

SAS EG 7.1 HF1 (32-bit)

________________________

- Cheers -

sasmilly
Calcite | Level 5
Thanks!

hackathon24-white-horiz.png

The 2025 SAS Hackathon Kicks Off on June 11!

Watch the live Hackathon Kickoff to get all the essential information about the SAS Hackathon—including how to join, how to participate, and expert tips for success.

YouTube LinkedIn

How to Concatenate Values

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

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