* In the case of NCDS pre-March 91 birth events, though, we want 'pregnum' to be zero,
* as we're deleting all reference to that event.
If (pre91flg=1 and key(#i)=40)xpregnu(#i)=0.
end if.
end loop.
* Copy the 'pregnancy' variables associated with that baby to the correct pregnancy slot (1-8).
* Note that within the 3-loop structure (#i,#j,#k) the copying is independent of the value of #k.
* i.e. anything up to five babies wrongly bunched in one pregnancy will have identical
* pregnancy data copied to different new pregnancy slots.
* Note also that, in the case of NCDS pre-March 91 birth events, the data for the 'eighth'
pregnancy
* (i.e. that corresponding to the 40th birth event) will be copied, and in all such NCDS cases
we know this is blank.
loop #i=1 to 8.
loop #j=1 to 8.
loop #k=1 to 5.
Do if (key(#i)=(5*#j+#k-5)).
compute xpregj(#i)=vpregj(#j).
compute xcg1prg(#i)=vcg1prg(#j).
compute xcg2prg(#i)=vcg2prg(#j).
compute xcg3prg(#i)=vcg3prg(#j).
compute xcpregb(#i)=vcpregb(#j).
compute xpregk(#i)=vpregk(#j).
compute xpregkw(#i)=vpregkw(#j).
compute xpregl(#i)=vpregl(#j).
end if.
end loop.
end loop.
end loop.
end if.
* Now address every single case that needed a manual alteration.
Do if (nserial='083034N').
Compute changed=2.
Compute key40(1)=21.
Compute key40(6)=11.
Compute key40(7)=16.
Compute key40(11)=6.
Compute key40(16)=1.
Compute keypreg(1)=5.
Compute keypreg(2)=3.
Compute keypreg(3)=2.
Compute keypreg(4)=1.
End if.
* The following cases all had exclusively pre-March 1991 birth event data, and were
* interviewed at NCDS5, so delete all birthslot information (i.e. make changed=2, but no key
values).
Do if (nserial='094029H' or nserial='330027Q' or nserial='986039J').