02-01-2016 12:55 PM
There are the insurance policies with customer_id, policy_id, revision_id and policy start and end dates.
I want to calculate the day between the renewal of two policies for the same customer
Some policies may have revisions (added some extra coverage) with same policy_id and end_date.
Here is the sample data:
For example for the policies 1247 and 1389, renewal day is: 365
For 1389 and 1543 it is: 0
Thank you very much!
02-01-2016 01:07 PM
Use the lag function to obtain the previous value of the end date.
data want; set have; by customerID; contract_end = lag1(end_date); if first.customerID then do; renewal=.; end; else renewal = datepart(start_date)-datepart(contract_end); run;
02-02-2016 03:50 AM - edited 02-02-2016 03:52 AM
Thank you for your reply.
The problem is many policies have revisions -as ı stated at example- with the same policy_id and end_date and different start_date (revision_date).
I want the date difference only between different policy_ids.
Do you have any idea?
02-02-2016 07:18 AM