@mdavidson wrote:
got it: INTCK('minute',field1,field2 )
INTCK can give results that aren't what you want in all cases, as it counts from the beginning of the interval (see the Details section of the documentation). If your data are recorded to the minute, it won't matter. If your data are recorded to the second, it might.
As datetime variables are recorded in seconds, an alternative is to use the fact that there are 60 seconds in a minutes and just do the arithmetic directly
(datetime2 - datetime1)/60 provides minutes with decimal fractions.
FLOOR( (datetime2 - datetime1)/60 ) provides the whole minute durations.
For instance, 12:01:50 to 12:02:10 is 1 using INTCK, 0.333 using the decimal minutes, and 0 using the FLOOR version.
@mdavidson wrote:
got it: INTCK('minute',field1,field2 )
INTCK can give results that aren't what you want in all cases, as it counts from the beginning of the interval (see the Details section of the documentation). If your data are recorded to the minute, it won't matter. If your data are recorded to the second, it might.
As datetime variables are recorded in seconds, an alternative is to use the fact that there are 60 seconds in a minutes and just do the arithmetic directly
(datetime2 - datetime1)/60 provides minutes with decimal fractions.
FLOOR( (datetime2 - datetime1)/60 ) provides the whole minute durations.
For instance, 12:01:50 to 12:02:10 is 1 using INTCK, 0.333 using the decimal minutes, and 0 using the FLOOR version.
Don't miss out on SAS Innovate - Register now for the FREE Livestream!
Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.
What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.
Find more tutorials on the SAS Users YouTube channel.