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
FGLS test to solve only Heteroskedasticity problem in Fixed Effect ModelHello, My dependent variable is NPLs (Non-performing Loans) and 6 independent variables - M3 = Money…
help with rowlast or rowfirstHello In my data, I have a number of columns beginning with gp_code_* ( aroound 100, but only a few…
selection Problem out of huge amount of occupationsDear Stata Community, Iam almost new to stata and Iam kind of stuck with a problem. May someone can…
3SLS fixed effects with panel dataI am trying to perform 3SLS with fixed effects in stata 16 and the command I put in is accepted and …
Any stata code for calculating adjusted number needed to be exposed (NNE)?Hello, I was wondering is there any Stata code available for calculating adjusted number needed to …
Subscribe to:
Post Comments (Atom)
0 Response to Issue with converting date in dd.mm.yy format to dd/mm/yyyy
Post a Comment