how to count time interval for each customer?
have:
| id | time |
| 103 | 07MAR2015:09:13:02.00 |
| 102 | 07DEC2015:10:42:19.00 |
| 102 | 07DEC2015:10:43:39.00 |
| 101 | 07MAY2015:09:13:30.00 |
| 102 | 07DEC2015:10:43:51.00 |
| 101 | 07MAY2015:09:13:41.00 |
| 103 | 07MAR2015:09:13:05.00 |
| 101 | 07MAY2015:09:13:55.00 |
want:
| id | time | interval |
| 101 | 07MAY15:09:13:30 | . |
| 101 | 07MAY15:09:13:41 | 11 |
| 101 | 07MAY15:09:13:55 | 14 |
| 102 | 07DEC15:10:42:19 | . |
| 102 | 07DEC15:10:43:39 | 80 |
| 102 | 07DEC15:10:43:51 | 12 |
| 103 | 07MAR15:09:13:02 | . |
| 103 | 07MAR15:09:13:05 | 3 |
Yes having the seconds included makes it clear how the value is to be determined.
This problem has been solve by PG Stats at this link. You might have to do a little work with the code so that the variables reference your case information.
https://communities.sas.com/t5/SAS-Programming/count-average-time-interval/m-p/487616#M127080
How does interval get assigned? your sample reflects that interval is char based on the sample being left justified.
You appear to want to do 2 things:
Yes having the seconds included makes it clear how the value is to be determined.
This problem has been solve by PG Stats at this link. You might have to do a little work with the code so that the variables reference your case information.
https://communities.sas.com/t5/SAS-Programming/count-average-time-interval/m-p/487616#M127080
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 lock in 2025 pricing—just $495!
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.