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!

sas-innovate-2024.png

Today is the last day to save with the early bird rate! Register today for just $695 - $100 off the standard rate.

 

Plus, pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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