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
Pie graph with missing values in spmapHi all, I wonder if its possible get a graph pie in blank if exist missing value in the data, examp…
RESET testHi, How can I run the RESET test for a gravity model with pair-fixed effects?: ppmlhdfe TRADE RTA …
Help in Fama McBeth regressionHi, I'm working on fund performance persistence. I want to run a Fama McBeth regression using marke…
Data interpretationHelp please with interpretation. Code: xtpcse ta rank score b safety health human ict prioritizatio…
Please help in codingDear all, I tried to code ethnic group but have difficulty. Survey question-What is your ethnicity?,…
Subscribe to:
Post Comments (Atom)
0 Response to Issue with converting date in dd.mm.yy format to dd/mm/yyyy
Post a Comment