* user = your-id * password = your-password * package = spss * project = lis define keepvars () . hweight d4 d5 d27 num6574 numge75 dpi . !enddefine . define pov () . select if dpi ne 0 . select if d5 ne 3 . compute ey = dpi/(d4**0.5) . compute pweight = hweight*d4 . compute cweight = hweight*d27 . compute eweight = hweight*(num6574+numge75) . weight by pweight . compute group = 1 . *** aggregate to get mean ey. agg outfile = ”U:\your-id_outmn” /presorted /break = group /meaney = mean(ey). *** use rank to get median dpi. rank dpi by group /ties = high /rfraction into mddpi. compute overmed = 0 . if mddpi gt 0.5 overmed = 1. temporary . select if overmed eq 1 . agg outfile = “U:\your-id_outmedpi” / presorted / break = group / meddpi = min(dpi). match files / file = * / table = “U:\your-id_outmedpi” / by group . match files / file = * / table = “U:\your-id_outmn” / by group . *** topcoding. if dpi gt (10*meddpi) ey = (10*meddpi)/d4**0.5 . *** bottomcoding. if ey lt (0.01*meaney) ey = 0.01*meaney . *** use rank to get median ey. rank ey /ties = high /rfraction into ranki . compute overmid = 0 . if ranki gt 0.5 overmid = 1. compute breakvar=1. temporary . select if overmid eq 1 . agg outfile=”U:\your-id_outmd” /presorted /break=breakvar /medi=min(ey). match files file = * /table=”U:\your-id_outmd” /by breakvar. compute povline4 = medi * 0.4 . compute povline5 = medi * 0.5 . compute povline6 = medi * 0.6 . compute poor40 = 0 . if ey lt povline4 poor40 = 1 . compute poor50 = 0 . if ey lt povline5 poor50 = 1 . compute poor60 = 0 . if ey lt povline6 poor60 = 1 . *** choose the weight to get the target population. weight by pweight. variable labels poor40 'overall poverty rate 40%'. variable labels poor50 'overall poverty rate 50%'. variable labels poor60 'overall poverty rate 60%'. descriptives poor40 poor50 poor60. weight by cweight. variable labels poor40 'child poverty rate 40%'. variable labels poor50 'child poverty rate 50%'. variable labels poor60 'child poverty rate 60%'. descriptives poor40 poor50 poor60. weight by eweight. variable labels poor40 'elderly poverty rate 40%'. variable labels poor50 'elderly poverty rate 50%'. variable labels poor60 'elderly poverty rate 60%'. descriptives poor40 poor50 poor60. !enddefine . get file = ccyyh / keep = keepvars . pov .