Dear all,
I have a dataset like this with three variables (Start_Day=Start day of a work contract; End_Day= End day of a working contract; Sex=Sex of the worker):
Start_Day End_Day Sex
01/03/2021 05/03/2021 M
03/03/2021 07/03/2021 M
06/03/2021 11/03/2021 F
I would like to know the number of Days worked per Day and Sex based on the previous dataset by generating a dataset with the following structure:
Day Days_Worked Sex
01/03/2021 1 M
01/03/2021 0 F
02/03/2021 1 M
02/03/2021 0 F
03/03/2021 2 M
03/03/2021 0 F
04/03/2021 2 M
04/03/2021 0 F
05/03/2021 2 M
05/03/2021 0 F
06/03/2021 1 M
06/03/2021 1 F
07/03/2021 1 M
07/03/2021 1 F
08/03/2021 0 M
08/03/2021 1 F
09/03/2021 0 M
09/03/2021 1 F
10/03/2021 0 M
10/03/2021 1 F
11/03/2021 0 M
11/03/2021 1 F
Any suggestions about a Stata code to achieve this result?
Thank you