Hello,
Example of data:
ID | BEGIN_TIME | END_TIME | amount_of_minutes |
349 | 13:07 | 15:06 | |
349 | 15:17 | 15:51 | 11 |
349 | 16:05 | 17:31 | 14 |
349 | 17:43 | 18:43 | 12 |
351 | 14:50 | 16:15 | |
351 | 18:57 | 19:38 | 162 |
367 | 12:07 | 12:42 | |
367 | 14:20 | 16:27 | 98 |
390 | 11:39 | 12:09 | |
390 | 14:03 | 15:35 | 114 |
390 | 18:45 | 19:40 | 190 |
390 | 22:26 | 23:23 | 166 |
is it possible to calculate the amount_of_minutes between the END_TIME and the BEGIN_TIME within the ID?
Thank you very much for any comments.
CODE NOT TEST.
data want;
set have;
by id;
amount_of_minutes =intck('minute',lag(END_TIME),BEGIN_TIME);
if first.id then call missing(amount_of_minutes );
run;
CODE NOT TEST.
data want;
set have;
by id;
amount_of_minutes =intck('minute',lag(END_TIME),BEGIN_TIME);
if first.id then call missing(amount_of_minutes );
run;
Thanks 🙂
It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.
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.