Hi,

I have trouble converting a string date (dd.mm.yy.) to a stata date variable.
I have tried this approach but it didn't work:

replace x=subinstr(x, ".","",. )
gen str2 day=substr(x,1,2)
gen str2 month=substr(x,3,4)
gen str2 year=substr(x,5,6)
destring day, replace
destring month, replace
destring year, replace
gen date= dmy(day, month, year)
format date %td



Code:
* Example generated by -dataex-. To install: ssc install dataex
clear
input str8 x
"150518"
"271117"
"150818"
"150218"
"141217"
"031014"
"260614"
"170614"
"090415"
"181217"
end


Any one who has a solution?

Thanks!