* user = your-id * password = your-password * package = spss * project = lis define run (). *** avoid double counting of cases. select if d5 ne 3. *** select cases where dpi is filled. select if dpi ne 0. *** create person weight as hweight times number of persons. compute pweight = hweight * d4. weight by pweight. *** set equivalence scale as square root of number of persons. compute y = dpi/(d4**0.5) . compute group = 1. *** aggregate to get mean ei. agg outfile = 'U:\your-id_outmn' /presorted /break = group /meanei = mean(y). *** use rank to get median dpi. rank dpi by group /ties = high /rfraction into meddpi. compute half = 0. if meddpi ge .5 half = 1. temporary. select if half = 1. agg outfile = 'U:\your-id_outmed' /presorted /break = group /medndpi = min(dpi). match files file = * /table = 'U:\your-id_outmn' /by group. match files file = * /table = 'U:\your-id_outmed' /by group. *** topcoding at ten times unequivalized median. if dpi gt (10*medndpi) y = (10*medndpi)/d4**.5. *** bottomcoding at one percent equivalized mean. if y lt (.01*meanei) y = .01*meanei. frequencies vars = y /percentiles=10 20 50 80 90 /format=notable. !enddefine get file = ccyyh /keep = d4 d5 dpi hweight d27 casenum. run.