Hello,
I have been trying to convert a string variable first_date into a date format with multiple methods and failing.
When using the command
gen first_date = date(start_date, "DMY")
format first_date %tddd/mm/CCYY
the majority of observations are missing values. Those that are converted are done so wrongly, for instance 9/0/2014 instead of 9/10/2014. I have noticed that the missing values are generated for all dates with double-digit days, for instance 11/25/2014 is a missing value in the date format.
I have checked that the string variable does not have any mistakes in it, and it was imported from an Excel file, in which it was in date format.
Thanks in advance for your help!
0 Response to Converting string to date without any missing values
Post a Comment