Hi all,
I am trying to calculate the time from the last tube feed (tube_stopped) to the time of surgery. Each patient has multiple tube stop times and also multiple surgeries (date_procedure). I want to create a new variable that calculates this called "Time from last tube feed to procedure" in hours....
Data have:
ID tube_stopped date_procedure
7 12Jul17:02:00:00 13JUL17:13:00:00
7 01AUG17:15:00:00 01AUG17:22:00:00
7 20JUL17:07:35:00 20JUL17:22:00:00
1 29JUL16:01:00:00 29JUL16:23:00:00
1 12AUG16:16:00:00 12AUG16:22:00:00
Data want:
ID tube_stopped date_procedure time from last tube feed to procedure
7 01AUG17:15:00:00 01AUG17:22:00:00 2.4
1 12AUG16:16:00:00 12AUG16:22:00:00 5.7
What does the LAG function do?
It's your turn to help shape SAS Innovate 2027. Share your expertise and inspire the SAS community.
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.