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;

SAS Innovate 2025: Call for Content

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!

Submit your idea!

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