Hello, I have a dataset with claims of medication, each line / observation is one claim. I have the patient_id and the date of the claim. Now I created a variable, which counts up the several claims per patient between the years 2014 and 2020, beginning with 1 for the first claim, 2 for the second, 3 for the third... The maximum number viaries from patient to patient. Now I want to create a new variable, which counts the number of days between one claim to the previous within each patient, meaning the number of days between the second to the first, the third to the second... I would be very happy for your help, thank you in advance.
... View more