Hi
I was playing around with the intnx function...
data _null_;
_datetime='25MAR2020:23:31:45.052348'dt;
second_b = intnx('second',_datetime,0,'b');
second_e = intnx('second',_datetime,0,'e');
put _datetime e8601dt26.6;
put second_b e8601dt26.6;
put second_e e8601dt26.6;
run;
I got the following output
2020-03-25T23:31:45.052348
2020-03-25T23:31:45.000000
2020-03-25T23:31:45.000000
But I was expecting something different for the end of the second, like .999999 instead of .000000
2020-03-25T23:31:45.052348
2020-03-25T23:31:45.000000
2020-03-25T23:31:45.999999
Did I miss something here?
Best Regards,
Véronique
The E and B modifiers would end up with an integer number of seconds and since you are applying them to the same base second with zero intervals applied you get the same result.
If you need something else such as the 0.99999 ending then increment the second to the beginning of the next and subtract a small amount such as
second_e = intnx('second',_datetime,1,'B') -.00001;
The E and B modifiers would end up with an integer number of seconds and since you are applying them to the same base second with zero intervals applied you get the same result.
If you need something else such as the 0.99999 ending then increment the second to the beginning of the next and subtract a small amount such as
second_e = intnx('second',_datetime,1,'B') -.00001;
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.