Hi,
I am trying to calculate the total number of hours spent on certain activities (no AM and PM codes are provided in the data) with the following data:
The variables, as you can see, are in string format. When I try to encode, the format is as follows:
I simply want the number of hours but most of the examples I have read about refer to elapsed time with days etc. Could someone point me in the right direction please as to what is the correct format needed to obtain elapsed time in this context?
Thank you.
I am trying to calculate the total number of hours spent on certain activities (no AM and PM codes are provided in the data) with the following data:
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input str5(slot_1_start slot_1_end) "" "" "" "" "" "" "05:00" "05:30" "" "" "" "" "" "" "05:00" "05:30" "" "" "" "" "" "" "06:00" "07:00" "" "" "" "" "" "" "06:30" "07:00" "" "" "" "" "" "" "06:00" "07:00" "" "" "" "" "" "" "05:00" "06:30" "" "" "" "" "" "" "06:30" "08:30" "" "" "" "" "" "" "06:30" "08:00" "" "" "" "" "" "" "05:30" "06:00" "" "" "" "" "" "" "06:00" "06:40" "" "" "" "" "" "" "06:00" "07:00" "" "" "" "" "" "" "06:00" "06:30" "" "" "" "" "" "" "06:00" "07:00" "" "" "" "" "" "" "07:00" "08:30" "" "" "" "" "" "" "06:00" "06:20" "" "" "" "" "" "" "05:00" "06:00" "" "" "" "" "" "" "05:30" "06:30" "" "" "" "" "" "" "05:00" "06:00" "" "" "" "" "" "" "06:00" "07:00" "" "" "" "" "" "" "06:00" "08:00" "" "" "" "" "" "" "06:00" "06:40" "" "" "" "" "" "" "06:00" "07:00" "" "" "" "" "" "" "05:00" "06:00" "" "" "" "" "" "" "06:00" "06:45" "" "" "" "" "" "" "" "" end
The variables, as you can see, are in string format. When I try to encode, the format is as follows:
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input long(slot1start slot1end) . . . . . . 5 5 . . . . . . 5 5 . . . . . . 10 17 . . . . . . 12 17 . . . . . . 10 17 . . . . . . 5 13 . . . . . . 12 21 . . . . . . 12 20 . . . . . . 7 9 . . . . . . 10 14 . . . . . . 10 17 . . . . . . 10 13 . . . . . . 10 17 . . . . . . 15 21 . . . . . . 10 12 . . . . . . 5 9 . . . . . . 7 13 . . . . . . 5 9 . . . . . . 10 17 . . . . . . 10 20 . . . . . . 10 14 . . . . . . 10 17 . . . . . . 5 9 . . . . . . 10 15 . . . . . . . . end format %td slot1start label values slot1start slot1start label def slot1start 5 "05:00", modify label def slot1start 7 "05:30", modify label def slot1start 10 "06:00", modify label def slot1start 12 "06:30", modify label def slot1start 15 "07:00", modify label values slot1end slot1end label def slot1end 5 "05:30", modify label def slot1end 9 "06:00", modify label def slot1end 12 "06:20", modify label def slot1end 13 "06:30", modify label def slot1end 14 "06:40", modify label def slot1end 15 "06:45", modify label def slot1end 17 "07:00", modify label def slot1end 20 "08:00", modify label def slot1end 21 "08:30", modify
I simply want the number of hours but most of the examples I have read about refer to elapsed time with days etc. Could someone point me in the right direction please as to what is the correct format needed to obtain elapsed time in this context?
Thank you.
Comment