I need to create variables that will mark in what years the treatment was taken by the patient.
I have data set that looks like this (data includes treatment periods, so 1 patient can have multiple rows of different treatments):

ID/ atc\_label / sdate / enddate 

1 / VitD / 31Oct2005 / 24Jan2005

1 / Steroid / 31Oct2008 / 24Jan2015

2 / Steroid / 15Oct2005 / 21Dec2010

3 / systemic/ 15Oct2007 / 21Dec2017

...

What I need is to create variables 2005, 2006, 2007, 2008, 2009.. until 2018. that will hold the correct atc\_label value if the treatment was used during this year.

I did start with the Year function, but I do not know how to create the intermediate variables between the start and end date.
I would appreciate any ideas on how to solve this.