Hello,
I am wanting to calculate the time in minutes between pairs of selected variables. The first pair of variables (starttime endtime) were read in as strings. I tried to destring these variables but received an error stating they contained non-numeric characters:
. destring starttime, gen (start)
starttime contains nonnumeric characters; no generate
For some reason, the other set of variables I entered were accepted as numeric characters. When I deducted Break12 - Break11 I obtained two values: 5400000 & 7260000
My two questions are:
1) what is required to substract the difference between starttime and endtime
2) what is the format of the output obtained by deducting Break12 - Break11? Looking at the raw data it should be 90 minutes: 20:12 - 18:42 (which is how the data was entered)
Any assistance is appreciated.
Bob
I am wanting to calculate the time in minutes between pairs of selected variables. The first pair of variables (starttime endtime) were read in as strings. I tried to destring these variables but received an error stating they contained non-numeric characters:
. destring starttime, gen (start)
starttime contains nonnumeric characters; no generate
For some reason, the other set of variables I entered were accepted as numeric characters. When I deducted Break12 - Break11 I obtained two values: 5400000 & 7260000
My two questions are:
1) what is required to substract the difference between starttime and endtime
2) what is the format of the output obtained by deducting Break12 - Break11? Looking at the raw data it should be 90 minutes: 20:12 - 18:42 (which is how the data was entered)
Any assistance is appreciated.
Bob
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input int id str5(starttime endtime) double(Break11 Break12 Break21 Break22 Break31 Break32) 3 "11:52" " 3:15" . . . . . . 4 " 5:13" "10:37" -1893388680000 -1893383280000 -1893378060000 -1893376979999.9998 . . 5 " 8:38" " 8:57" . . . . . . 7 " " "12:10" . . . . . . 14 " 2:46" " 8:31" . . . . . . 15 " 1:45" "12:16" -1893449280000 -1893442020000 -1.8934347e+12 -1893433380000.0002 -1.8934293e+12 -1893412980000 end format %tchh:MM Break11 format %tchh:MM Break12 format %tchh:MM Break21 format %tchh:MM Break22 format %tchh:MM Break31 format %tchh:MM Break32
Comment