Hi everyone. I am trying to fill in missing values in one variable by completing it with values from another one. I am working with observations with often lack the end date, in which case I want to make the end date be the same as the start date. I use this code:

foreach x of end_year {
replace end_year = start_year `x' if missing(end_year`x')
}

and I am getting an error message saying "invalid 'end_year'). Nevertheless, I have triple checked for extra spaces, but this does not seem to be the issue. What could it be? Thank you.