I want to create a variable with the number of the day a participant took a survey (first day, second day, thirds day, etc.) The issue is that there are participants that took the survey after midnight. For example, this is what it looks like:
Id date
1 08/03/2020 08:17
1 08/03/2020 12:01
1 08/04/2020 15:08
1 08/04/2020 22:16
2 07/03/2020 08:10
2 07/03/2020 12:03
2 07/04/2020 15:07
2 07/05/2020 00:16
3 08/22/2020 09:17
3 08/23/2020 11:04
3 08/24/2020 00:01
4 10/03/2020 08:37
4 10/03/2020 11:13
4 10/04/2020 15:20
4 10/04/2020 23:05
This is what I want:
Id date day
1 08/03/2020 08:17 1
1 08/03/2020 12:01 1
1 08/04/2020 15:08 2
1 08/04/2020 22:16 2
2 07/03/2020 08:10 1
2 07/03/2020 12:03 1
2 07/04/2020 15:07 2
2 07/05/2020 00:16 2
3 08/22/2020 09:17 1
3 08/23/2020 11:04 2
3 08/24/2020 00:01 2
4 10/03/2020 08:37 1
4 10/03/2020 11:13 1
4 10/04/2020 15:20 2
4 10/04/2020 23:05 2
How can I create the day variable taking into consideration participants that who took the survey after midnight still belong to the previous day?
Queenie Yong is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.