Good evening, I would like to kindly ask for help subtracting these two times. The variable cs_wake_time is the time the person wakes up, and cs_bed_time is the time they go to bed.
In order to subtract the times, I tried converting them to a time format using the following:
gen cs_wake_timea = clock(cs_wake_time, "hm")
format cs_wake_timea %tcHH:MM
But the result is only missing values.
In order to subtract the times, I tried converting them to a time format using the following:
gen cs_wake_timea = clock(cs_wake_time, "hm")
format cs_wake_timea %tcHH:MM
But the result is only missing values.
Code:
* Example generated by -dataex-. For more info, type help dataex clear input str5(cs_wake_time cs_bed_time) "9 am" "11 pm" "9 am" "11 pm" "8 am" "12 am" "6 am" "10 pm" "7 am" "10 pm" "7 am" "1 am" "9 am" "11 pm" "7 am" "1 am" "7 am" "1 am" "7 am" "12 am" end
Comment