* vectors all start off system-missing once declared).
vector xpregnu xpregj xcg1prg xcg2prg xcg3prg xcpregb xmorprg(8, f1.0).
vector xpregk xpregkw(8,f3.0).
vector xpregl(8,f2.0).
vector xprega xpregc xpregd xkilo xpregf xpregh xwhopa xwerkd xwatkd xabspa
xabspb xabspc xabskb xabskc xabskd xabske(40,f1.0).
vector xpound xounce xprged xprgem xpregg xwhopb xabska xabsmn(40,f2.0).
vector xgramm xprgey xabsyr(40,f4.0).
vector xprege(40,a8).
vector xpregi(40,a100).
*Declare vector BIRDAT to compare all forty possible outcome dates chronologically.
vector birdat(40, f6.0).
*Declare vector 'key' to keep track of which slot the data relating to the nth most recent
pregnancy was originally placed in.
* This is used in the automatic re-ordering of cases with no multiple births, dubious outcomes
or other horrible complications.
vector key(8, f1.0).
*Declare vector 'key' to keep track of which of the 40 'baby' slots the data relating to the nth
most recent baby was originally
* placed in. This is used in the re-ordering of individual cases from the manual scrutiny.
vector key40(40, f1.0).
*Declare vector 'keypreg' to keep track of which of the 8 'pregnancy' slots the data relating to
the nth most recent pregnancy was originally
* placed in. This is used in the re-ordering of individual cases from the manual scrutiny.
vector keypreg(8, f1.0).
*Declare vector 'compdt' to create new composite date variable which includes '99' codes and
imputed figures for missing days and months.
vector compdt (40,f8.0).
*Declare vector 'outdat' to keep track of which is the most recent pregnancy outcome, during
the process of re-ordering them.
vector outdat(40, f6.0).
* Don't look at any CM who's never been/got anybody pregnant.
Do if(everpreg=1).
* Define vectors for date and pregnancy outcome variables, needed to sort out wrong
order/bunching problems etc.
* Regrettably these (and later, all the other 35 pregnancy history variables) all have to be
defined/copied in this
* long-winded way, because the 40 versions of each variable are not consecutive on the
1999/2000 dataset.
compute vprega1=prega.
compute vprega2=prega2.
compute vprega3=prega3.
compute vprega4=prega4.
compute vprega5=prega5.
compute vprega6=prega6.
compute vprega7=prega7.
compute vprega8=prega8.
compute vprega9=prega9.
compute vprega10=prega10.
compute vprega11=prega11.