Hi all, As I'm quite new to SAS I'm still learning some basic steps. I have the following dataset: contract_nr start_date end_date product_code 1392358 01-02-2017 31-07-2017 A 1392358 01-08-2017 30-11-2017 A 1392358 01-12-2017 28-02-2018 B 1392358 01-03-2018 30-04-2018 B 1847204 08-12-2017 31-12-2017 A 1847204 02-02-2018 31-03-2018 B (I tried to make a example SAS code, but failed) I want to find out when a product code has changed, but only if there are less than, say, 20 days between the start and end date. So, my want dataset looks like this: contract_nr start_date end_date product_code indicator 1392358 01-02-2017 31-07-2017 A 0 1392358 01-08-2017 30-11-2017 A 0 1392358 01-12-2017 28-02-2018 B 1 1392358 01-03-2018 30-04-2018 B 1 1847204 08-12-2017 31-12-2017 A 0 1847204 02-02-2018 31-03-2018 B 0 By the way, the product code can only change from A to B. I prefer not to use loops, but I do think we can get around them. I hope someone can help me!
... View more