Collapsing data using aggregate. This sums up the weights of the children in each family, and then saves that file as d:famtot.sav.
data list list
/ famid * kidname (A4) birth * age * wt * sex (A1) .
BEGIN DATA.
1 Beth 1 9 60 f
1 Bob 2 6 40 m
1 Barb 3 3 20 f
2 Andy 1 8 80 m
2 Al 2 6 50 m
2 Ann 3 2 20 f
3 Pete 1 6 60 m
3 Pam 2 4 40 f
3 Phil 3 2 20 m
END DATA.
SORT CASES BY famid.
AGGREGATE OUTFILE="d:famtot.sav"
/BREAK=famid
/sumwt = sum(wt).
GET FILE = "d:famtot.sav".
LIST CASES.
