Graph cumulative percentage retired at attained age by categorical variable
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 | DATA LIST LIST /retire age rich. BEGIN DATA 0 45 0 0 45 0 0 45 0 0 55 0 1 55 0 0 65 0 0 60 0 1 60 0 1 45 0 1 65 0 0 45 0 0 55 1 0 55 1 1 60 1 0 65 1 1 55 1 1 60 0 1 65 1 1 60 1 1 65 1 1 65 1 1 65 1 END DATA. LIST. VALUE LABEL rich 0 'poor' 1 'rich'. SORT CASES BY rich age. SAVE OUTFILE='c:\\temp\\data.sav'. GET FILE='c:\\temp\\data.sav'. AGGREGATE OUTFILE=* /BREAK rich age /retire=SUM(retire) /n=n. DO IF $CASENUM=1. + COMPUTE cretire=retire. + COMPUTE clives=n. ELSE IF (rich=1 AND LAG(rich)=0). + COMPUTE cretire=retire. + COMPUTE clives=n. ELSE. + COMPUTE cretire=retire + LAG(cretire). + COMPUTE clives=n + LAG(clives). END IF. EXECUTE. COMPUTE pc=cretire/clives. GRAPH /LINE(MULTIPLE)MEAN(pc) BY age BY rich /MISSING=REPORT. |
Related pages
...