I have a historical dataset with teenagers' birthday in the format of dd.mm.yy, while they were all born after 1980.
e.g.
15.03.88
02.06.95
...
The variable name is: dob
I wrote the following syntax, but returned with empty values, it seems nothing has been converted:
gen dob_new = date(dob, "DMY")
format dob_new %tdDD/MM/YYYY
I also tried the following:
gen dob_num = clock(substr(dob, 1, 2) + "/" + substr(dob, 4, 2) + "/20" + substr(dob, 7, 2), "DMY")
It works but I don't know how to convert it back to dd/mm/yyyy format.
Could anyone please help?
0 Response to Issue with converting date in dd.mm.yy format to dd/mm/yyyy
Post a Comment