Hi all,

I am having a type mismatch error for the following code (final line before the curly brace) when la_seroa is an empty variable. Is there any way for this code to work even if la_seroa is entirely missing?

forval x=1/$max_sero {
gen sero`x'_final = ""
replace sero`x'_final = sero`x'_clean if use_sero`x'== 1
replace sero`x'_final = la_seroa if use_sero`x'== 2 & num_variant_seroa==`x'
}

Thank you!