You didn't answer the question in #14.
We need to see data for which missing values are generated. The recipe looks good.
We need to see data for which missing values are generated. The recipe looks good.
clear
input str9 n_dob str5 n_tob str9 n_doa str5 n_toa
"01-Mar-20" "20:45" "01-Mar-20" "20:55"
"14-Feb-20" "21:47" "15-Feb-20" "01:20"
"14-Dec-19" "21:12" "31-Dec-19" "14:00"
"14-Jan-20" "19:42" "21-Jan-20" "03:15"
"12-Mar-20" "09:03" "18-Mar-20" "21:35"
"28-Feb-20" "20:30" "28-Feb-20" "23:40"
"14-Feb-20" "15:06" "14-Feb-20" "16:20"
"26-Jan-20" "01:24" "26-Jan-20" "02:45"
"31-Dec-19" "20:30" "04-Jan-20" "19:20"
"15-Feb-20" "10:02" "15-Feb-20" "11:45"
end
gen double age = (clock(n_doa + " " + n_toa,"DM20Yhm") - clock(n_dob + " " + n_tob,"DM20Yhm")) / (3600000*24)
list
+---------------------------------------------------+
| n_dob n_tob n_doa n_toa age |
|---------------------------------------------------|
1. | 01-Mar-20 20:45 01-Mar-20 20:55 .00694444 |
2. | 14-Feb-20 21:47 15-Feb-20 01:20 .14791667 |
3. | 14-Dec-19 21:12 31-Dec-19 14:00 16.7 |
4. | 14-Jan-20 19:42 21-Jan-20 03:15 6.3145833 |
5. | 12-Mar-20 09:03 18-Mar-20 21:35 6.5222222 |
|---------------------------------------------------|
6. | 28-Feb-20 20:30 28-Feb-20 23:40 .13194444 |
7. | 14-Feb-20 15:06 14-Feb-20 16:20 .05138889 |
8. | 26-Jan-20 01:24 26-Jan-20 02:45 .05625 |
9. | 31-Dec-19 20:30 04-Jan-20 19:20 3.9513889 |
10. | 15-Feb-20 10:02 15-Feb-20 11:45 .07152778 |
+---------------------------------------------------+
Comment