I have a string variable with timestamps. Please see example data below:
When I convert using the following code:
It misses observations where minutes part is not included. For example, " April 11 2023 10pm " and " April 11 2023 10pm " will be missing in the generated values. Is there a simple way to fix this issue?
Thanks,
Ali
Code:
* Example generated by -dataex-. For more info, type help dataex clear input str30 report_date " April 11 2022 9:37pm " " April 11 2022 9:58am " " April 11 2023 10pm " " April 11 2023 10pm " " April 11 2023 5:10am " " April 11 2023 8:55pm " " April 12 2016 9:16pm " " April 12 2019 10:30pm " " April 12 2020 10:43am " " April 12 2021 10:11am " " April 12 2021 12:20pm " end
Code:
gen _report_dt = clock(report_date, "MDY hm") format _report_dt %tc
Thanks,
Ali

Comment