Skip to main content

Table 3 The steps and SPSS syntax to aggregate hospital admissions for mental illness during pregnancy

From: Data preparation techniques for a perinatal psychiatric study based on linked data

Step

Variable and explanation

SPSS Syntax

Summarize hospital admissions of all principal diagnoses of mental illness during pregnancy

Select the period of pregnancy and sort record according to hospital admission date.PPN_mum: mother’s Project Person Number AGEAdmMum: mother’s age in days at hospital admission

USE ALL.COMPUTE filter_$ = ( Admmonth > = 13 Admmonth < = 23).VARIABLE LABELS filter_$ ' Admmonth >= 13 Admmonth < = 23 (FILTER)'.VALUE LABELS filter_$ 0 'Not Selected' 1 'Selected'.FORMATS filter_$ (f1.0).FILTER BY filter_$.EXECUTE.SORT CASES BY PPN_mum (A) AGEAdmMum(A).

 

Prin10_sum: the total hospital admissions for principal diagnosis of mental illness during pregnancy

AGGREGATE/OUTFILE = * MODE = ADDVARIABLES/BREAK = PPN_mum /Prin10_sum = SUM(Prin10).

Order the principal diagnoses of mental illness during pregnancy in sequence

Select and sort the records during pregnancy

FILTER OFF.USE ALL.SELECT IF (Admmonth > = 13 & Admmonth < = 23).EXECUTE.SORT CASES BY PPN_mum(A) AGEAdmMum(A).

 

Morder: The sequent order of mother’s hospital admission

compute Morder = 1.if ( PPN_mum = lag(PPN_mum )) Morder = lag(Morder ) + 1.format Morder (F2).VARIABLE LABELS Morder 'Mother’s hospital admission order (during pregnancy)'.EXECUTE.

 

Order the principal diagnosis of mental illness. Prin10order: the order of mother’s hospital admissions for principal diagnosis of mental illness (F00-99) during pregnancy

IF ( Morder EQ 1) #counter = 0.IF (Prin10 EQ 1 AND #counter GE 1) #counter = #counter + 1.IF (Prin10 EQ 1 AND #counter GE 1) Prin10order = #counter.IF (Prin10 EQ 1 AND #counter EQ 0) Prin10order = 1.IF (Prin10 EQ 1 AND #counter EQ 0) #counter = 1.FORMATS Prin10order (F2).VARIABLE LABELS Prin10order 'The order of mother’s hospital admissions for principal diagnosis of mental illness (F00-99) during pregnancy'.EXECUTE.