Appendix 12
SPSS Syntax for ‘patch’ to re-order cases with outcomes wrongly
bunched or out of chronological order, to examine miscellaneous
anomalous cases, and to eliminate pre-March 1991 NCDS pregnancy
histories
* 'Undeclare' all missing values for outcome and date of outcome variables, otherwise SPSS
'If' test for values '99', '9999' won't work.
missing values prega prega2 prega3 prega4 prega5 prega6 prega7 prega8 prega9 prega10
prega11 prega12 prega13 prega14 prega15 prega16 prega17 prega18 prega19 prega20
prega21 prega22 prega23 prega24 prega25 prega26 prega27 prega28 prega29 prega30
prega31 prega32 prega33 prega34 prega35 prega36 prega37 prega38 prega39 prega40
preged preged2 preged3 preged4 preged5 preged6 preged7 preged8 preged9 preged10
preged11 preged12 preged13 preged14 preged15 preged16 preged17 preged18 preged19
preged20
preged21 preged22 preged23 preged24 preged25 preged26 preged27 preged28 preged29
preged30
preged31 preged32 preged33 preged34 preged35 preged36 preged37 preged38 preged39
preged40
pregem pregem2 pregem3 pregem4 pregem5 pregem6 pregem7 pregem8 pregem9
pregem10
pregem11 pregem12 pregem13 pregem14 pregem15 pregem16 pregem17 pregem18
pregem19 pregem20
pregem21 pregem22 pregem23 pregem24 pregem25 pregem26 pregem27 pregem28
pregem29 pregem30
pregem31 pregem32 pregem33 pregem34 pregem35 pregem36 pregem37 pregem38
pregem39 pregem40
pregey pregey2 pregey3 pregey4 pregey5 pregey6 pregey7 pregey8 pregey9 pregey10
pregey11 pregey12 pregey13 pregey14 pregey15 pregey16 pregey17 pregey18 pregey19
pregey20
pregey21 pregey22 pregey23 pregey24 pregey25 pregey26 pregey27 pregey28 pregey29
pregey30
pregey31 pregey32 pregey33 pregey34 pregey35 pregey36 pregey37 pregey38 pregey39
pregey40 ().
* Declare vectors corresponding to all 'baby' variables (length 40), and 'pregnancy' variables
(length 8),
* so we can process all the slots using loop structures.
vector vpregnu vpregj vcg1prg vcg2prg vcg3prg vcpregb vmorprg(8, f1.0).
vector vpregk vpregkw(8,f3.0).
vector vpregl(8,f2.0).
vector vprega vpregc vpregd vkilo vpregf vpregh vwhopa vwerkd vwatkd vabspa
vabspb vabspc vabskb vabskc vabskd vabske (40,f1.0).
vector vpound vounce vprged vprgem vpregg vwhopb vabska vabsmn(40,f2.0).
vector vgramm vprgey vabsyr(40,f4.0).
vector vprege(40,a8).
vector vpregi(40,a100).
* Declare second copy of the vectors, to facilitate the process of placing everything in new
positions after re-ordering
* (as the original variables are unfortunately not consecutive in the data file, it's easier to do it
with a fresh lot of vectors.
* It also saves having to have hundreds of 'compute' statements to initialise all the variables
to system-missing, as these