Efficient Loops

#1
I have a series of 14 yes-no variables that I need to code into a shorter list of 6 "Changtype" variables with coded values.
If a code used in in an earlier changetype, then I don't want to use it in a later one for the same person.
So I devised this very long and complicated code (this is the code for the 8th variable).
I am not terribly familiar with how to run LOOP statements, but trying to learn. I imagine this would be much more efficient with some kind of LOOP.
Can someone help me translate this into something a bit more compact.

Do IF (CHactiv8_2=1 and CHangtype_2a=0).
compute Changtype_2a=8.
end if.
execute.

Do IF (CHactiv8_2=1 and Changtype_2a NE 0 and Changtype_2a NE 8 and CHangtype_2b=0).
compute Changtype_2b=8.
else if (CHactiv8_2=1 and Changtype_2a NE 0 and Changtype_2a NE 8 and CHangtype_2b NE 0 and Changtype_2b NE 8 and Changtype_2c=0).
compute Changtype_2c=8.
else if (CHactiv8_2=1 and Changtype_2a NE 0 and Changtype_2a NE 8 and CHangtype_2b NE 0 and Changtype_2b NE 8 and
Changtype_2c NE 0 and Changtype_2c NE 8 and Changtype_2d=0).
compute Changtype_2d=8.
else if (CHactiv8_2=1 and Changtype_2a NE 0 and Changtype_2a NE 8 and CHangtype_2b NE 0 and Changtype_2b NE 8
and CHangtype_2c NE 0 and CHangtype_2c NE 8 and CHangtype_2d NE 0 and CHangtype_2d NE 8 and CHangtype_2e=0 ).
compute cHangtype_2e=8.
ELSE IF (CHactiv8_2=1 and Changtype_2a NE 0 and Changtype_2a NE 8 and CHangtype_2b NE 0 and Changtype_2b NE 8
and CHangtype_2c NE 0 and CHangtype_2c NE 8 and CHangtype_2d NE 0 and CHangtype_2d NE 8 and CHangtype_2e NE 0
and CHangtype_2e NE 8 and changtype_2f=0).
compute cHangtype_2f=8.
end if .
execute.

DO IF (CHactiv8_2=1 and (Changtype_2a NE 0 and Changtype_2a NE 8) and (CHangtype_2b NE 0 and Changtype_2b NE 8)
and (CHangtype_2c NE 0 and CHangtype_2c NE 8) and (CHangtype_2d NE 0 and CHangtype_2d NE 8) and (CHangtype_2e NE 0
and CHangtype_2e NE 8) and (Changtype_2f NE 0 and cHangtype_2f NE 8) and changtype_2g =0 ).
compute changtype_2g =8.
end if .
execute.

DO if (CHactiv8_2=1 and (Changtype_2a NE 0 and Changtype_2a NE 8) and (CHangtype_2b NE 0 and Changtype_2b NE 8)
and (CHangtype_2c NE 0 and CHangtype_2c NE 8) and (CHangtype_2d NE 0 and CHangtype_2d NE 8) and (CHangtype_2e NE 0
and CHangtype_2e NE 8) and (Changtype_2f NE 0 and cHangtype_2f NE 8) and (changtype_2g NE 0 and cHangtype_2g NE 8) and changtype_2h=0).
compute changtype_2h =8.
end if .
execute.

Thank you!