I have a field, CHPROPSC, that I would like to code with missings as -97, -98 or -99 and a calculated value based on the value of field PRCHSCH04 and PRCHSCH13.
Essentially, if the value in PRCHSCH04 is -99 only then CHPROPSC = -98. If the value in PRCHSCH13 is -99 only then CHPROPSC = -97. If the value in both is -99 then CHPROPSC = -99. Otherwise CHPROPSC = PRCHSCH13 - PRCHSCH04.
I tried this Python script (and a few variations of this) without the codeblock but there was a processing failure:
-97 if !PRCHSCH13! == -99 & !PRCHSCH04! <> -99
-98 elif !PRCHSCH13! <> -99 & !PRCHSCH04! == -99
-99 elif !PRCHSCH13! == -99 & !PRCHSCH04! == -99
else float( !PRCHSCH13! )- !PRCHSCH04!
I am sure my syntax with the elif is the most likely problem. Any advice as to where the error is here?
Thanks,
Steve