I have data with the customer IDs and dates the customer was interacted with. I would like to create a new variable that shows how long a customer has been in touch with in days
Customer ID | Date of Contact
211 2015-02-24
211 2015-06-17
211 2015-08-11
202 2015-01-02
202 2014-06-19
194 2015-07-28
The idea is that for every customer the new variable should calculate the number of days between his latest interaction and oldest interaction. So for example in the customer of customer ID 211, it will be the number of days between 2015-08-11 and 2015-02-24 (168 days)
If there has only been one interaction with a customer, then the days should be 0 (as is the case with customer ID 194)
Thank you for your help!