I have two date variables in my dataset. They show the beginning and end dates of a person's leadership. My data is like this:
Now I want to create a year variable that shows each year in which a person has the leadership position. For example, for person A, the data should be like this:
I'd appreciate if anyone could help.
Code:
person startdate enddate A 28/12/2000 21/12/2004 B 27/09/1962 05/11/1967 C 17/11/1993 08/06/1998 D 18/11/1958 01/11/1964 E 02/04/2000 31/12/2004 F 01/01/1996 31/12/2004
Code:
person Year A 2000 A 2001 A 2002 A 2003 A 2004

Comment