Hi. In the code you posted you only format the date variables in the date values you put to the log. The date variables in the data set will not be formatted. Use a Format Statement like this
data test;
date1='01jan18'd;
date2='31dec18'd;
format date1 date2 ddmmyy8.;
run;