Have:
| START DATE | START TIME | END DATE | END TIME | |
| ID01 | 12/7/2013 | 10:00:00 | 12/8/2013 | 10:00:00 |
| ID02 | 12/7/2013 | 9:00:00 | 12/8/2013 | 9:00:00 |
Want:three more new variables START, END, Time interval from START to END in seconds
| START DATE | START TIME | START | END DATE | END TIME | END | Time Interval in Seconds |
ID01 | 12/7/2013 | 10:00:00 AM | 12/7/2013 10:00:00 AM | 12/8/2013 | 13:00:00 pm | 12/8/2013 13:00:00 pm | ?? |
ID02 | 12/7/2013 | 9:00:00 AM | 12/7/2013 9:00:00 AM | 12/8/2013 | 16:00:00 PM | 12/8/2013 16:00:00 pm | ?? |
Thanks!
start = dhms(start_date,Hour(start_time), Minute(start_time), Second(start_time));
end = dhms(end_date,Hour(end_time), Minute(end_time), Second(end_time));
interval = intck("SECOND", start, end);
PG
start = dhms(start_date,Hour(start_time), Minute(start_time), Second(start_time));
end = dhms(end_date,Hour(end_time), Minute(end_time), Second(end_time));
interval = intck("SECOND", start, end);
PG
Thanks!
This is so quick and awesome.
It's working!!!
I would skip all those extra functions as arguments to DHMS.
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and save with the early bird rate—just $795!
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.
Ready to level-up your skills? Choose your own adventure.