Hello, I am using the following code to convert string dates to numeric:
capture drop dos_rc //making into usable date
gen dos_rc = date(dos, "DM20Yhm")
format dos_rc %td
Some dates are converted and some are not despite the string having the same format for those converted and not converted. doc_rc is the recoded date variable. Any ideas on why the code returns missing for some but not other cases?
dos_rc dos
05sep2017 5/9/2017 4:00 PM
05sep2017 5/9/2017 4:00 PM
05sep2017 5/9/2017 4:00 PM
05sep2017 5/9/2017 4:00 PM
05sep2017 5/9/2017 4:00 PM
5/15/2017 3:30 PM
5/15/2017 2:00 PM
5/15/2017 2:00 PM
5/15/2017 2:00 PM
capture drop dos_rc //making into usable date
gen dos_rc = date(dos, "DM20Yhm")
format dos_rc %td
Some dates are converted and some are not despite the string having the same format for those converted and not converted. doc_rc is the recoded date variable. Any ideas on why the code returns missing for some but not other cases?
dos_rc dos
05sep2017 5/9/2017 4:00 PM
05sep2017 5/9/2017 4:00 PM
05sep2017 5/9/2017 4:00 PM
05sep2017 5/9/2017 4:00 PM
05sep2017 5/9/2017 4:00 PM
5/15/2017 3:30 PM
5/15/2017 2:00 PM
5/15/2017 2:00 PM
5/15/2017 2:00 PM
Comment