Dear Stata users,

I have a date variable formatted using %tmCCYYMon. However, I have identified a subset of observations for which years are wrong: they should be equal to 2018 instead of 2019. I can easily identify which observation is wrong by using a "flag" dummy.

Is there a way to directly modify the variable using -- replace date = .... if flag==1 --

This may sound like a simple question, but I cannot find an answer anywhere.

Thank you in advance,
Jack