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?
Related Posts with Issue with converting date in dd.mm.yy format to dd/mm/yyyy
Interaction terms in panel dataDear all, I am currently working on my master thesis : i am analyzing the link between board gender…
System GMM omitted variablesDear Sirs, I have received the following comment from a reviewer: "what are the main omitted variab…
Creating a concentration index for time delay between eventsHi Statalist, I am working with a dataset regarding students and their exam scores. I have data on …
Interpretation sum of coefficientsDear Stata users, I have a question regarding the interpretation of my coefficients. I use an IV (T…
Unrecognized command (spbalance)Dear Stata senior users, I am preparing my spatial panel data without shapefile (as instructed at ht…
Subscribe to:
Post Comments (Atom)
0 Response to Issue with converting date in dd.mm.yy format to dd/mm/yyyy
Post a Comment