* Encoding: windows-1252. * Merge. * Match files. data list list / name (a10) tomato zucchini peas grapes. begin data. Gregor 10.00 2.00 40.00 .0 Molly 15.00 5.00 10.00 1000.00 Susan 20.00 .0 20.00 Luther 50.00 10.00 15.00 50.00 end data. dataset name A window=front. data list list / name (a10) city (a6). begin data. Gregor Brno Molly Luther Munich Susan Boston end data. dataset name B window=front. * Notice the observations are not in the same order. * This is what happens with a plain merge. match files /file=B /file=A. execute. dataset name byposition window=front. * the better approach is a MATCH merge, but this also requires a SORT. dataset activate A. sort cases by name. dataset activate B. sort cases by name. match files /file=A /file=B /by name. execute. dataset name byname2 window=front. GET FILE='Y:\spssworkshop\more garden cases.sav'. DATASET NAME C WINDOW=FRONT. match files /file=a /in=first /file=c /in=second /by name. execute. select if first=1 & second=1. execute. select if ~missing(peas). execute. * Missing data. dataset activate A. string city (A6). * Whatever data is in the first dataset, wins. match files /file=A /file=B /by name. execute. dataset name missingconflict window=front. GET FILE='Y:\spssworkshop\Employee data.sav'. DATASET NAME DataSet2 WINDOW=FRONT. AGGREGATE /OUTFILE=* MODE=ADDVARIABLES /BREAK=jobcat /salary_mean=MEAN(salary) /salary_median=median(salary). compute dummy=1. execute. AGGREGATE /OUTFILE=* MODE=ADDVARIABLES /BREAK=dummy /grand_mean=MEAN(salary) /grand_median=median(salary).