I have (quite stupidly) have code of this type

if market=="a" {
replace o=1
replace e=1
replace state="w"
replace date="10/8/16"
}

I have this for about 600 markets and several statements inside so my do file stretches to over 9000 lines. I have now realized that the -if- does not work properly when conditioned on a specific value of a variable. Is there any quick way to implement a change for all of 600 market -if- conditions? Would be very grateful for some help!