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
Insignificant Pooled OLS model running with bank lending dataHi, We are writing our master thesis on the effect of capital requirements on bank lending, using t…
Help on control variablesDear everyone, I am running a regression of banks in around 26 countries, and I want to include con…
matsize and Pesaran estimationLadies & Gentlemen, up to 7 regressors, STATA could produce regression output successfully. When…
Comparison before-and-after mean for each individual (t-test)Hi, I am a graduate student. I have variables indicating a test score and retirement dummy. I want …
Help on labeling categorical variablesHello I'm working with my data file but find difficulty on labelling derived categorical variables.…
Subscribe to:
Post Comments (Atom)
0 Response to Issue with converting date in dd.mm.yy format to dd/mm/yyyy
Post a Comment