*This program calcltates Gini coefficient corssatbulated by other *categorical variables such a region. Hhsize etc… **** The input parameters are: **** the welfare infdicator such as PCCons. **** the braeking variable such as TYPE2 . **** The weight variable such as POPW. Get file consagg.sav. comp nobreak =1. val lab nobreak 1 'All population' . Comp var = consallae. autorecode ur /into Byvar. comp w = popw. *****************************************************************************************. SORT CASES BY byvar var . split file by byvar . *Cumulative number of population. CREATE /hhsize_c=CSUM(w). COMP x= w* var . CREATE /cumpcc=CSUM(x). AGGR OUTF * mode addvar /break = byvar / allpop =sum (w) /allc =sum (x) . **** calculaing the population and consumption shares. COMPUTE cumpopsh = hhsize_c / allpop . COMPUTE cumpccsh = cumpcc / allc . ************ GINI. COMPUTE GINI = (cumpopsh - cumpccsh)*2 . formats Gini (f8.4). WEIGHT BY w . means gini . ******* select each 10- th point for chart . comp nnn = $casenum/10. exec. select if nnn = trunc(nnn). ************* lorenze curve . var lab cumpopsh 'Population' /cumpccsh ' Consumption' . VAr lab Byvar 'Lorenze curve '. GRAPH /SCATTERPLOT(BIVAR)=cumpopsh WITH cumpccsh/ template lorence.sgt /MISSING=LISTWISE.