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

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

 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
ballardw
Super User

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;

View solution in original post

1 REPLY 1
ballardw
Super User

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;

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

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
  • 1 reply
  • 853 views
  • 0 likes
  • 2 in conversation