I always get lost with INTNX
I have a date time variable called flightdate...example: 01JAN2014:00:28:00.000
I want to add 8 hours to this. So I use intnx('hour', t1.flightdate,8) and I get 01JAN2014:08:00:00.000
I would like the minutes to come over as well and be 01JAN2014:08:28:00.000
Any way to get this to happen?
Make sure to specify the fourth parameter, the alignment or the default applies which is not what you want here. Instead try the 'S' option.
intnx('hour', t1.flightdate,8, 's')
@BCNAV wrote:
I always get lost with INTNX
I have a date time variable called flightdate...example: 01JAN2014:00:28:00.000
I want to add 8 hours to this. So I use intnx('hour', t1.flightdate,8) and I get 01JAN2014:08:00:00.000
I would like the minutes to come over as well and be 01JAN2014:08:28:00.000
Any way to get this to happen?
You don't really need INTNX to do add or substract time to a datetime variable. You can respect SAS date and time conventions with time literals, like this:
nextFlightDate = flightDate + '08:00:00't;
You can also do:
intnx('seconds', t1.flightdate,28800)
Tough command to remember everything....thanks all!
Available on demand!
Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.
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.
Select SAS Training centers are offering in-person courses. View upcoming courses for: