* Wealth index calculation. Trevor Croft, 02/08/2017. India NFHS 2014-16. cd 'C:\Projects\Analysis\Wealth Index Construction\IndiaNFHS4\Wealth'. include file='C:\Projects\Analysis\Wealth Index Construction\IndiaNFHS4\Wealth\wealth_assets.sps'. missing values QH50 (999.9). execute. set tvars=both. * Macro definitions to perform some recoding automatically. * Note: Do not use an asterisk in front of a macro name to try to comment it out - it will run any way because of the way the macros are expanded. * Delete the line instead or change the spelling of the macro in the comment. * Do not use the names of macros in comments - they will also be expanded too, and likely will fail. *{Create binary variables based on condition and give label }. define dichotomize( !positional !enclose('(',')') / !positional !tokens(1) / !positional !tokens(1) ) compute !2=0. if (!1) !2=1. variable labels !2 !3. value labels !2 0 'No' 1 'Yes'. formats !2 (f1.0). !enddefine. *(Separate shared toilets from non-shared toilets). define shared_fac( !positional !tokens(1) / !positional !tokens(1) / !positional !tokens(1) ). compute !2 = 0. do if (QH32=1). + if (!1=1) !2 = 1. + compute !1 = 0. end if. variable labels !2 !3. value labels !2 0 'No' 1 'Yes'. formats !2 (f1.0). !enddefine. *{Reset missing values to 'does not have', change 2 code to 0}. define no2zero( !positional !tokens(1) ) if (missing(!1) | !1<>1) !1=0. value labels !1 0 'No' 1 'Yes'. !enddefine. *{Construct Variables}. * Source of drinking water. dichotomize (QH25=11) QH25_11 "Source of drinking water: Piped - into dwelling". dichotomize (QH25=12) QH25_12 "Source of drinking water: Piped - into yard / plot". dichotomize (QH25=13) QH25_13 "Source of drinking water: Piped - public tap / standpipe". dichotomize (QH25=21) QH25_21 "Source of drinking water: Tube well / borehole". dichotomize (QH25=31) QH25_31 "Source of drinking water: Dug well - protected". dichotomize (QH25=32) QH25_32 "Source of drinking water: Dug well - unprotected". dichotomize (QH25=41) QH25_41 "Source of drinking water: Spring water - protected". dichotomize (QH25=42) QH25_42 "Source of drinking water: Spring water - unprotected". dichotomize (QH25=51) QH25_51 "Source of drinking water: Rainwater". dichotomize (QH25=61) QH25_61 "Source of drinking water: Tanker truck". dichotomize (QH25=71) QH25_71 "Source of drinking water: Cart with small tank". dichotomize (QH25=81) QH25_81 "Source of drinking water: Surface water (river / dam / lake / pond / stream / canal / irrigation channel)". dichotomize (QH25=91) QH25_91 "Source of drinking water: Bottled water". dichotomize (QH25=92) QH25_92 "Source of drinking water: Community RO Plant". dichotomize (QH25=96) QH25_96 "Source of drinking water: Other". * Type of toilet facility. dichotomize (QH31=11) QH31_11 "Type of toilet facility: Flush - to piped sewer system". dichotomize (QH31=12) QH31_12 "Type of toilet facility: Flush - to septic tank". dichotomize (QH31=13) QH31_13 "Type of toilet facility: Flush - to pit latrine". dichotomize (QH31=14) QH31_14 "Type of toilet facility: Flush - to somewhere else". dichotomize (QH31=15) QH31_15 "Type of toilet facility: Flush - don't know where". dichotomize (QH31=21) QH31_21 "Type of toilet facility: Ventilated Improved Pit (VIP) / biogas latrine". dichotomize (QH31=22) QH31_22 "Type of toilet facility: Pit latrine - with slab". dichotomize (QH31=23) QH31_23 "Type of toilet facility: Pit latrine - without slab / open pit". dichotomize (QH31=31) QH31_31 "Type of toilet facility: Twin pit / composting toilet". dichotomize (QH31=41) QH31_41 "Type of toilet facility: Dry toilet". dichotomize (QH31=51) QH31_51 "Type of toilet facility: No facility / uses open space / or field". dichotomize (QH31=96) QH31_96 "Type of toilet facility: Other". shared_fac QH31_11 QH31_11_sh "Type of toilet facility: Flush - to piped sewer system - shared". shared_fac QH31_12 QH31_12_sh "Type of toilet facility: Flush - to septic tank - shared". shared_fac QH31_13 QH31_13_sh "Type of toilet facility: Flush - to pit latrine - shared". shared_fac QH31_14 QH31_14_sh "Type of toilet facility: Flush - to somewhere else - shared". shared_fac QH31_15 QH31_15_sh "Type of toilet facility: Flush - don't know where - shared". shared_fac QH31_21 QH31_21_sh "Type of toilet facility: Ventilated Improved Pit (VIP) / biogas latrine - shared". shared_fac QH31_22 QH31_22_sh "Type of toilet facility: Pit latrine - with slab - shared". shared_fac QH31_23 QH31_23_sh "Type of toilet facility: Pit latrine - without slab / open pit - shared". shared_fac QH31_31 QH31_31_sh "Type of toilet facility: Twin pit / composting toilet - shared". shared_fac QH31_41 QH31_41_sh "Type of toilet facility: Dry toilet - shared". shared_fac QH31_96 QH31_96_sh "Type of toilet facility: Other - shared". * Electricity. no2zero QH37A. * Mattress. no2zero QH37B. * Pressure cooker. no2zero QH37C. * Chair. no2zero QH37D. * Cot or bed. no2zero QH37E. * Table. no2zero QH37F. * Electric fan. no2zero QH37G. * Radio or transistor. no2zero QH37H. * Black and white television. no2zero QH37I. * Colour television. no2zero QH37J. * Sewing machine. no2zero QH37K. * Mobile telephone. no2zero QH37L. * Telephone (non-mobile). no2zero QH37M. * Internet. no2zero QH37N. * Computer. no2zero QH37O. * Refrigerator. no2zero QH37P. * Air conditioner/cooler. no2zero QH37Q. * Washing machine. no2zero QH37R. * Watch or clock. no2zero QH37S. * Bicycle. no2zero QH37T. * Motorcycle or Scooter. no2zero QH37U. * Animal-drawn cart. no2zero QH37W. * Car. no2zero QH37X. * Water pump. no2zero QH37Y. * Thresher. no2zero QH37Z. * Tractor. no2zero QH37XA. * Type of cooking fuel. dichotomize (QH38=1) QH38_1 "Type of cooking fuel: Electricity". dichotomize (QH38=2) QH38_2 "Type of cooking fuel: LPG / natural gas". dichotomize (QH38=3) QH38_3 "Type of cooking fuel: Biogas". dichotomize (QH38=4) QH38_4 "Type of cooking fuel: Kerosene". dichotomize (QH38=5) QH38_5 "Type of cooking fuel: Coal / lignite". dichotomize (QH38=6) QH38_6 "Type of cooking fuel: Charcoal". dichotomize (QH38=7) QH38_7 "Type of cooking fuel: Wood". dichotomize (QH38=8) QH38_8 "Type of cooking fuel: Straw / shrubs / grass". dichotomize (QH38=9) QH38_9 "Type of cooking fuel: Agricultural crop waste". dichotomize (QH38=10) QH38_10 "Type of cooking fuel: Dung cakes". dichotomize (QH38=95) QH38_95 "Type of cooking fuel: No food cooked in household". dichotomize (QH38=96) QH38_96 "Type of cooking fuel: Other". * Main material of floor. dichotomize (QH42=11) QH42_11 "Main material of floor: Mud / clay / earth". dichotomize (QH42=12) QH42_12 "Main material of floor: Sand". dichotomize (QH42=13) QH42_13 "Main material of floor: Dung". dichotomize (QH42=21) QH42_21 "Main material of floor: Raw wood planks". dichotomize (QH42=22) QH42_22 "Main material of floor: Palm / bamboo". dichotomize (QH42=23) QH42_23 "Main material of floor: Brick". dichotomize (QH42=24) QH42_24 "Main material of floor: Stone". dichotomize (QH42=31) QH42_31 "Main material of floor: Parquet / polished wood". dichotomize (QH42=32) QH42_32 "Main material of floor: Vinyl / asphalt". dichotomize (QH42=33) QH42_33 "Main material of floor: Ceramic tiles". dichotomize (QH42=34) QH42_34 "Main material of floor: Cement". dichotomize (QH42=35) QH42_35 "Main material of floor: Carpet". dichotomize (QH42=36) QH42_36 "Main material of floor: Polished stone / marble / granite". dichotomize (QH42=96) QH42_96 "Main material of floor: Other". * Main roof material. dichotomize (QH43=11) QH43_11 "Main roof material: No roof". dichotomize (QH43=12) QH43_12 "Main roof material: Thatch / palm leaf / reed / grass". dichotomize (QH43=13) QH43_13 "Main roof material: Mud". dichotomize (QH43=14) QH43_14 "Main roof material: Sod / mud and grass mixture". dichotomize (QH43=15) QH43_15 "Main roof material: Plastic / polythene sheeting". dichotomize (QH43=21) QH43_21 "Main roof material: Rustic mat". dichotomize (QH43=22) QH43_22 "Main roof material: Palm / bamboo". dichotomize (QH43=23) QH43_23 "Main roof material: Raw wood planks / timber". dichotomize (QH43=24) QH43_24 "Main roof material: Unburnt brick". dichotomize (QH43=25) QH43_25 "Main roof material: Loosely packed stone". dichotomize (QH43=31) QH43_31 "Main roof material: Metal / GI". dichotomize (QH43=32) QH43_32 "Main roof material: Wood". dichotomize (QH43=33) QH43_33 "Main roof material: Calamine / cement fiber". dichotomize (QH43=34) QH43_34 "Main roof material: Asbesto sheets". dichotomize (QH43=35) QH43_35 "Main roof material: RCC / RBC / cement / concrete". dichotomize (QH43=36) QH43_36 "Main roof material: Roofing shingles". dichotomize (QH43=37) QH43_37 "Main roof material: Tiles". dichotomize (QH43=38) QH43_38 "Main roof material: Slate". dichotomize (QH43=39) QH43_39 "Main roof material: Burnt brick". dichotomize (QH43=96) QH43_96 "Main roof material: Other". * Main wall material. dichotomize (QH44=11) QH44_11 "Main wall material: No walls". dichotomize (QH44=12) QH44_12 "Main wall material: Cane / palm / trunks / bamboo". dichotomize (QH44=13) QH44_13 "Main wall material: Mud". dichotomize (QH44=14) QH44_14 "Main wall material: Grass / reeds / thatch". dichotomize (QH44=21) QH44_21 "Main wall material: Bamboo with mud". dichotomize (QH44=22) QH44_22 "Main wall material: Stone with mud". dichotomize (QH44=23) QH44_23 "Main wall material: Plywood". dichotomize (QH44=24) QH44_24 "Main wall material: Cardboard". dichotomize (QH44=25) QH44_25 "Main wall material: Unburnt brick". dichotomize (QH44=26) QH44_26 "Main wall material: Raw wood / reused wood". dichotomize (QH44=31) QH44_31 "Main wall material: Cement / concrete". dichotomize (QH44=32) QH44_32 "Main wall material: Stone with lime / cement". dichotomize (QH44=33) QH44_33 "Main wall material: Burnt bricks". dichotomize (QH44=34) QH44_34 "Main wall material: Cement blocks". dichotomize (QH44=35) QH44_35 "Main wall material: Wood planks / shingles". dichotomize (QH44=36) QH44_36 "Main wall material: GI/ metal / asbestos sheets". dichotomize (QH44=96) QH44_96 "Main wall material: Other". * Hectares for agricultural land. compute landarea = 0. if (QH50U = 1) landarea = QH50. /* Acres */ if (QH50U = 2) landarea = QH50*2.47105381. /* Hectare = 2.47105381 Acres */ if (QH50U = 2 & landarea >= 995 & landarea <= 999) landarea = 995 if (QH50U = 6) landarea = 9996. /* Different unit - set to missing */ if (QH50U >= 8) landarea = 0. if (missing(QH50) | QH50 >= 999.8) landarea=9999. if (missing(QH48 ) | QH48 <> 1) landarea=0. missing values landarea (9996,9999). * Out of this land, how much is irrigated?. compute irrigated = 0. if (QH50U = 1) irrigated = QH51. /* Acres */ if (QH50U = 2) irrigated = QH51*2.47105381. /* Hectare = 2.47105381 Acres */ if (QH50U = 2 & irrigated >= 995 & irrigated <= 999) irrigated = 995 if (QH50U = 6) irrigated = 9996. /* Different unit - set to missing */ if (QH50U >= 8) irrigated = 0. if (QH51 = 999.5) irrigated = 0. if (missing(QH51) | QH51 >= 999.8) irrigated=9999. if (missing(QH48 ) | QH48 <> 1) irrigated=0. missing values irrigated (9996,9999). * Cows / bulls / buffaloes. no2zero QH52A. * Camels. no2zero QH52B. * Horses / donkeys / mules. no2zero QH52C. * Goats. no2zero QH52D. * Sheep. no2zero QH52E. * Chickens / ducks. no2zero QH52F. * Bank account. no2zero QH53. *{Members per sleeping room}. if (hhusual=0) hhusual=hhslept. if (QH45>0) memsleep=trunc(hhusual/QH45). if (QH45=0) memsleep=hhusual. if (missing(QH45) or QH45>=99 or memsleep>=98) memsleep=99. variable labels memsleep 'Number of members per sleeping room'. value labels memsleep 0 'Less than 1 per room'. formats memsleep (f2.0). missing values memsleep (99). * Compute urban and rural variables coded (1/0) for filters later. compute urban=(QHTYPE = 1). compute rural=(QHTYPE = 2). variable labels urban 'Urban' / rural 'Rural'. value labels urban 1 'Urban' / rural 1 'Rural'. formats urban rural (f1.0). execute. * Check on indicator variable creation. frequencies variables=QHTYPE to domestic. * Toilet facility by shared/not shared. crosstabs /tables=QH31 by QH32. * Land area by units - if there are separate units - need to convert them to one unit. crosstabs /tables=QH50 by QH50U. crosstabs /tables=QH51 by QH50U. frequencies variables= QH25_11 QH25_12 QH25_13 QH25_21 QH25_31 QH25_32 QH25_41 QH25_42 QH25_51 QH25_61 QH25_71 QH25_81 QH25_91 QH25_92 QH25_96 QH31_11 QH31_12 QH31_13 QH31_14 QH31_15 QH31_21 QH31_22 QH31_23 QH31_31 QH31_41 QH31_51 QH31_96 QH31_11_sh QH31_12_sh QH31_13_sh QH31_14_sh QH31_15_sh QH31_21_sh QH31_22_sh QH31_23_sh QH31_31_sh QH31_41_sh QH31_96_sh QH37A QH37B QH37C QH37D QH37E QH37F QH37G QH37H QH37I QH37J QH37K QH37L QH37M QH37N QH37O QH37P QH37Q QH37R QH37S QH37T QH37U QH37W QH37X QH37Y QH37Z QH37XA QH38_1 QH38_2 QH38_3 QH38_4 QH38_5 QH38_6 QH38_7 QH38_8 QH38_9 QH38_10 QH38_95 QH38_96 QH42_11 QH42_12 QH42_13 QH42_21 QH42_22 QH42_23 QH42_24 QH42_31 QH42_32 QH42_33 QH42_34 QH42_35 QH42_36 QH42_96 QH43_11 QH43_12 QH43_13 QH43_14 QH43_15 QH43_21 QH43_22 QH43_23 QH43_24 QH43_25 QH43_31 QH43_32 QH43_33 QH43_34 QH43_35 QH43_36 QH43_37 QH43_38 QH43_39 QH43_96 QH44_11 QH44_12 QH44_13 QH44_14 QH44_21 QH44_22 QH44_23 QH44_24 QH44_25 QH44_26 QH44_31 QH44_32 QH44_33 QH44_34 QH44_35 QH44_36 QH44_96 QH53 DOMESTHH DOMESTIC HOUSE LAND memsleep landarea irrigated QH52A QH52B QH52C QH52D QH52E QH52F . * Turn off weights before all factor analysis. weight off. * Name the dataset window for the HH data for use later. dataset name assets. save outfile='assets.sav'. *** Test Factor Analysis. filter off. execute. factor /variables QH25_11 QH25_12 QH25_13 QH25_21 QH25_31 QH25_32 QH25_41 QH25_42 QH25_51 QH25_61 QH25_71 QH25_81 QH25_91 QH25_92 QH25_96 QH31_11 QH31_12 QH31_13 QH31_14 QH31_15 QH31_21 QH31_22 QH31_23 QH31_31 QH31_41 QH31_51 QH31_96 QH31_11_sh QH31_12_sh QH31_13_sh QH31_14_sh QH31_15_sh QH31_21_sh QH31_22_sh QH31_23_sh QH31_31_sh QH31_41_sh QH31_96_sh QH37A QH37B QH37C QH37D QH37E QH37F QH37G QH37H QH37I QH37J QH37K QH37L QH37M QH37N QH37O QH37P QH37Q QH37R QH37S QH37T QH37U QH37W QH37X QH37Y QH37Z QH37XA QH38_1 QH38_2 QH38_3 QH38_4 QH38_5 QH38_6 QH38_7 QH38_8 QH38_9 QH38_10 QH38_95 QH38_96 QH42_11 QH42_12 QH42_13 QH42_21 QH42_22 QH42_23 QH42_24 QH42_31 QH42_32 QH42_33 QH42_34 QH42_35 QH42_36 QH42_96 QH43_11 QH43_12 QH43_13 QH43_14 QH43_15 QH43_21 QH43_22 QH43_23 QH43_24 QH43_25 QH43_31 QH43_32 QH43_33 QH43_34 QH43_35 QH43_36 QH43_37 QH43_38 QH43_39 QH43_96 QH44_11 QH44_12 QH44_13 QH44_14 QH44_21 QH44_22 QH44_23 QH44_24 QH44_25 QH44_26 QH44_31 QH44_32 QH44_33 QH44_34 QH44_35 QH44_36 QH44_96 QH53 DOMESTHH DOMESTIC HOUSE LAND memsleep landarea irrigated QH52A QH52B QH52C QH52D QH52E QH52F /missing meansub /analysis QH25_11 QH25_12 QH25_13 QH25_21 QH25_31 QH25_32 QH25_41 QH25_42 QH25_51 QH25_61 QH25_71 QH25_81 QH25_91 QH25_92 QH25_96 QH31_11 QH31_12 QH31_13 QH31_14 QH31_15 QH31_21 QH31_22 QH31_23 QH31_31 QH31_41 QH31_51 QH31_96 QH31_11_sh QH31_12_sh QH31_13_sh QH31_14_sh QH31_15_sh QH31_21_sh QH31_22_sh QH31_23_sh QH31_31_sh QH31_41_sh QH31_96_sh QH37A QH37B QH37C QH37D QH37E QH37F QH37G QH37H QH37I QH37J QH37K QH37L QH37M QH37N QH37O QH37P QH37Q QH37R QH37S QH37T QH37U QH37W QH37X QH37Y QH37Z QH37XA QH38_1 QH38_2 QH38_3 QH38_4 QH38_5 QH38_6 QH38_7 QH38_8 QH38_9 QH38_10 QH38_95 QH38_96 QH42_11 QH42_12 QH42_13 QH42_21 QH42_22 QH42_23 QH42_24 QH42_31 QH42_32 QH42_33 QH42_34 QH42_35 QH42_36 QH42_96 QH43_11 QH43_12 QH43_13 QH43_14 QH43_15 QH43_21 QH43_22 QH43_23 QH43_24 QH43_25 QH43_31 QH43_32 QH43_33 QH43_34 QH43_35 QH43_36 QH43_37 QH43_38 QH43_39 QH43_96 QH44_11 QH44_12 QH44_13 QH44_14 QH44_21 QH44_22 QH44_23 QH44_24 QH44_25 QH44_26 QH44_31 QH44_32 QH44_33 QH44_34 QH44_35 QH44_36 QH44_96 QH53 DOMESTHH DOMESTIC HOUSE LAND memsleep landarea irrigated QH52A QH52B QH52C QH52D QH52E QH52F /print univariate initial extraction fscore /criteria factors(1) iterate(25) /extraction pc /rotation norotate /method=correlation. *** Common Factor analysis ***. ** Removed area-specific variables **. ** Agricultural animal variables excluded ** Land area excluded ** Any others ?. *** Common Factor Analysis. filter off. execute. factor /variables QH25_11 QH25_12 QH25_13 QH25_21 QH25_31 QH25_32 QH25_41 QH25_42 QH25_51 QH25_61 QH25_71 QH25_81 QH25_91 QH25_92 QH25_96 QH31_11 QH31_12 QH31_13 QH31_14 QH31_15 QH31_21 QH31_22 QH31_23 QH31_31 QH31_41 QH31_51 QH31_96 QH31_11_sh QH31_12_sh QH31_13_sh QH31_14_sh QH31_15_sh QH31_21_sh QH31_22_sh QH31_23_sh QH31_31_sh QH31_41_sh QH31_96_sh QH37A QH37B QH37C QH37D QH37E QH37F QH37G QH37H QH37I QH37J QH37K QH37L QH37M QH37N QH37O QH37P QH37Q QH37R QH37S QH37T QH37U QH37W QH37X QH37Y QH37Z QH37XA QH38_1 QH38_2 QH38_3 QH38_4 QH38_5 QH38_6 QH38_7 QH38_8 QH38_9 QH38_10 QH38_95 QH38_96 QH42_11 QH42_12 QH42_13 QH42_21 QH42_22 QH42_23 QH42_24 QH42_31 QH42_32 QH42_33 QH42_34 QH42_35 QH42_36 QH42_96 QH43_11 QH43_12 QH43_13 QH43_14 QH43_15 QH43_21 QH43_22 QH43_23 QH43_24 QH43_25 QH43_31 QH43_32 QH43_33 QH43_34 QH43_35 QH43_36 QH43_37 QH43_38 QH43_39 QH43_96 QH44_11 QH44_12 QH44_13 QH44_14 QH44_21 QH44_22 QH44_23 QH44_24 QH44_25 QH44_26 QH44_31 QH44_32 QH44_33 QH44_34 QH44_35 QH44_36 QH44_96 QH53 DOMESTHH DOMESTIC HOUSE LAND memsleep /missing meansub /analysis QH25_11 QH25_12 QH25_13 QH25_21 QH25_31 QH25_32 QH25_41 QH25_42 QH25_51 QH25_61 QH25_71 QH25_81 QH25_91 QH25_92 QH25_96 QH31_11 QH31_12 QH31_13 QH31_14 QH31_15 QH31_21 QH31_22 QH31_23 QH31_31 QH31_41 QH31_51 QH31_96 QH31_11_sh QH31_12_sh QH31_13_sh QH31_14_sh QH31_15_sh QH31_21_sh QH31_22_sh QH31_23_sh QH31_31_sh QH31_41_sh QH31_96_sh QH37A QH37B QH37C QH37D QH37E QH37F QH37G QH37H QH37I QH37J QH37K QH37L QH37M QH37N QH37O QH37P QH37Q QH37R QH37S QH37T QH37U QH37W QH37X QH37Y QH37Z QH37XA QH38_1 QH38_2 QH38_3 QH38_4 QH38_5 QH38_6 QH38_7 QH38_8 QH38_9 QH38_10 QH38_95 QH38_96 QH42_11 QH42_12 QH42_13 QH42_21 QH42_22 QH42_23 QH42_24 QH42_31 QH42_32 QH42_33 QH42_34 QH42_35 QH42_36 QH42_96 QH43_11 QH43_12 QH43_13 QH43_14 QH43_15 QH43_21 QH43_22 QH43_23 QH43_24 QH43_25 QH43_31 QH43_32 QH43_33 QH43_34 QH43_35 QH43_36 QH43_37 QH43_38 QH43_39 QH43_96 QH44_11 QH44_12 QH44_13 QH44_14 QH44_21 QH44_22 QH44_23 QH44_24 QH44_25 QH44_26 QH44_31 QH44_32 QH44_33 QH44_34 QH44_35 QH44_36 QH44_96 QH53 DOMESTHH DOMESTIC HOUSE LAND memsleep /print univariate initial extraction fscore /criteria factors(1) iterate(25) /extraction pc /rotation norotate /save reg(ALL com) /method=correlation. *** Urban Factor Analysis. filter off. filter by urban. execute. factor /variables QH25_11 QH25_12 QH25_13 QH25_21 QH25_31 QH25_32 QH25_41 QH25_42 QH25_51 QH25_61 QH25_71 QH25_81 QH25_91 QH25_92 QH25_96 QH31_11 QH31_12 QH31_13 QH31_14 QH31_15 QH31_21 QH31_22 QH31_23 QH31_31 QH31_41 QH31_51 QH31_96 QH31_11_sh QH31_12_sh QH31_13_sh QH31_14_sh QH31_15_sh QH31_21_sh QH31_22_sh QH31_23_sh QH31_31_sh QH31_41_sh QH31_96_sh QH37A QH37B QH37C QH37D QH37E QH37F QH37G QH37H QH37I QH37J QH37K QH37L QH37M QH37N QH37O QH37P QH37Q QH37R QH37S QH37T QH37U QH37W QH37X QH37Y QH37Z QH37XA QH38_1 QH38_2 QH38_3 QH38_4 QH38_5 QH38_6 QH38_7 QH38_8 QH38_9 QH38_10 QH38_95 QH38_96 QH42_11 QH42_12 QH42_13 QH42_21 QH42_22 QH42_23 QH42_24 QH42_31 QH42_32 QH42_33 QH42_34 QH42_35 QH42_36 QH42_96 QH43_11 QH43_12 QH43_13 QH43_14 QH43_15 QH43_21 QH43_22 QH43_23 QH43_24 QH43_25 QH43_31 QH43_32 QH43_33 QH43_34 QH43_35 QH43_36 QH43_37 QH43_38 QH43_39 QH43_96 QH44_11 QH44_12 QH44_13 QH44_14 QH44_21 QH44_22 QH44_23 QH44_24 QH44_25 QH44_26 QH44_31 QH44_32 QH44_33 QH44_34 QH44_35 QH44_36 QH44_96 QH53 DOMESTHH DOMESTIC HOUSE LAND memsleep landarea irrigated QH52A QH52B QH52C QH52D QH52E QH52F /missing meansub /analysis QH25_11 QH25_12 QH25_13 QH25_21 QH25_31 QH25_32 QH25_41 QH25_42 QH25_51 QH25_61 QH25_71 QH25_81 QH25_91 QH25_92 QH25_96 QH31_11 QH31_12 QH31_13 QH31_14 QH31_15 QH31_21 QH31_22 QH31_23 QH31_31 QH31_41 QH31_51 QH31_96 QH31_11_sh QH31_12_sh QH31_13_sh QH31_14_sh QH31_15_sh QH31_21_sh QH31_22_sh QH31_23_sh QH31_31_sh QH31_41_sh QH31_96_sh QH37A QH37B QH37C QH37D QH37E QH37F QH37G QH37H QH37I QH37J QH37K QH37L QH37M QH37N QH37O QH37P QH37Q QH37R QH37S QH37T QH37U QH37W QH37X QH37Y QH37Z QH37XA QH38_1 QH38_2 QH38_3 QH38_4 QH38_5 QH38_6 QH38_7 QH38_8 QH38_9 QH38_10 QH38_95 QH38_96 QH42_11 QH42_12 QH42_13 QH42_21 QH42_22 QH42_23 QH42_24 QH42_31 QH42_32 QH42_33 QH42_34 QH42_35 QH42_36 QH42_96 QH43_11 QH43_12 QH43_13 QH43_14 QH43_15 QH43_21 QH43_22 QH43_23 QH43_24 QH43_25 QH43_31 QH43_32 QH43_33 QH43_34 QH43_35 QH43_36 QH43_37 QH43_38 QH43_39 QH43_96 QH44_11 QH44_12 QH44_13 QH44_14 QH44_21 QH44_22 QH44_23 QH44_24 QH44_25 QH44_26 QH44_31 QH44_32 QH44_33 QH44_34 QH44_35 QH44_36 QH44_96 QH53 DOMESTHH DOMESTIC HOUSE LAND memsleep landarea irrigated QH52A QH52B QH52C QH52D QH52E QH52F /print univariate initial extraction fscore /criteria factors(1) iterate(25) /extraction pc /rotation norotate /save reg(ALL urb) /method=correlation. *** Rural Factor Analysis. filter off. filter by rural. execute. factor /variables QH25_11 QH25_12 QH25_13 QH25_21 QH25_31 QH25_32 QH25_41 QH25_42 QH25_51 QH25_61 QH25_71 QH25_81 QH25_91 QH25_92 QH25_96 QH31_11 QH31_12 QH31_13 QH31_14 QH31_15 QH31_21 QH31_22 QH31_23 QH31_31 QH31_41 QH31_51 QH31_96 QH31_11_sh QH31_12_sh QH31_13_sh QH31_14_sh QH31_15_sh QH31_21_sh QH31_22_sh QH31_23_sh QH31_31_sh QH31_41_sh QH31_96_sh QH37A QH37B QH37C QH37D QH37E QH37F QH37G QH37H QH37I QH37J QH37K QH37L QH37M QH37N QH37O QH37P QH37Q QH37R QH37S QH37T QH37U QH37W QH37X QH37Y QH37Z QH37XA QH38_1 QH38_2 QH38_3 QH38_4 QH38_5 QH38_6 QH38_7 QH38_8 QH38_9 QH38_10 QH38_95 QH38_96 QH42_11 QH42_12 QH42_13 QH42_21 QH42_22 QH42_23 QH42_24 QH42_31 QH42_32 QH42_33 QH42_34 QH42_35 QH42_36 QH42_96 QH43_11 QH43_12 QH43_13 QH43_14 QH43_15 QH43_21 QH43_22 QH43_23 QH43_24 QH43_25 QH43_31 QH43_32 QH43_33 QH43_34 QH43_35 QH43_36 QH43_37 QH43_38 QH43_39 QH43_96 QH44_11 QH44_12 QH44_13 QH44_14 QH44_21 QH44_22 QH44_23 QH44_24 QH44_25 QH44_26 QH44_31 QH44_32 QH44_33 QH44_34 QH44_35 QH44_36 QH44_96 QH53 DOMESTHH DOMESTIC HOUSE LAND memsleep landarea irrigated QH52A QH52B QH52C QH52D QH52E QH52F /missing meansub /analysis QH25_11 QH25_12 QH25_13 QH25_21 QH25_31 QH25_32 QH25_41 QH25_42 QH25_51 QH25_61 QH25_71 QH25_81 QH25_91 QH25_92 QH25_96 QH31_11 QH31_12 QH31_13 QH31_14 QH31_15 QH31_21 QH31_22 QH31_23 QH31_31 QH31_41 QH31_51 QH31_96 QH31_11_sh QH31_12_sh QH31_13_sh QH31_14_sh QH31_15_sh QH31_21_sh QH31_22_sh QH31_23_sh QH31_31_sh QH31_41_sh QH31_96_sh QH37A QH37B QH37C QH37D QH37E QH37F QH37G QH37H QH37I QH37J QH37K QH37L QH37M QH37N QH37O QH37P QH37Q QH37R QH37S QH37T QH37U QH37W QH37X QH37Y QH37Z QH37XA QH38_1 QH38_2 QH38_3 QH38_4 QH38_5 QH38_6 QH38_7 QH38_8 QH38_9 QH38_10 QH38_95 QH38_96 QH42_11 QH42_12 QH42_13 QH42_21 QH42_22 QH42_23 QH42_24 QH42_31 QH42_32 QH42_33 QH42_34 QH42_35 QH42_36 QH42_96 QH43_11 QH43_12 QH43_13 QH43_14 QH43_15 QH43_21 QH43_22 QH43_23 QH43_24 QH43_25 QH43_31 QH43_32 QH43_33 QH43_34 QH43_35 QH43_36 QH43_37 QH43_38 QH43_39 QH43_96 QH44_11 QH44_12 QH44_13 QH44_14 QH44_21 QH44_22 QH44_23 QH44_24 QH44_25 QH44_26 QH44_31 QH44_32 QH44_33 QH44_34 QH44_35 QH44_36 QH44_96 QH53 DOMESTHH DOMESTIC HOUSE LAND memsleep landarea irrigated QH52A QH52B QH52C QH52D QH52E QH52F /print univariate initial extraction fscore /criteria factors(1) iterate(25) /extraction pc /rotation norotate /save reg(ALL rur) /method=correlation. * Label the created score variables. rename variables (com1 urb1 rur1=comscore urbscore rurscore). variable labels comscore 'Common wealth score' /urbscore 'Urban wealth score' /rurscore 'Rural wealth score'. * Add a variable used for linking later. filter off. string rowtype_ (A8). compute rowtype_ = 'EST'. * Calculate regressions. ** Area=urban. filter off. filter by urban. execute. * Declare a dataset to be written to in the regression. dataset declare urbancorv. * Run regression of comscore with urbscore. regression /missing listwise /statistics coeff outs R anova /criteria=pin(.05) pout(.10) /noorigin /dependent comscore /method=enter urbscore /outfile=corv(urbancorv). * Activate file of output from regression. dataset activate urbancorv. * Drop all rows of output except the coefficients. select if (rowtype_ = 'EST'). execute. * Delete unnecessary variables before merging. delete variables DEPVAR_ VARNAME_. * Rename variables containing the constant and the coefficient. rename variables CONST_=urbconst urbscore=urbcoeff. * Re-activate the main household data. dataset activate assets. * merge the coefficients. match files /file = * /table = urbancorv /by ROWTYPE_. execute. * Calculate regressions. ** Area=rural. filter off. filter by rural. execute. * Declare a dataset to be written to in the regression. dataset declare ruralcorv. * Run regression of comscore with rurscore. regression /missing listwise /statistics coeff outs R anova /criteria=pin(.05) pout(.10) /noorigin /dependent comscore /method=enter rurscore /outfile=corv(ruralcorv). * Activate file of output from regression. dataset activate ruralcorv. * Drop all rows of output except the coefficients. select if (rowtype_ = 'EST'). execute. * Delete unnecessary variables before merging. delete variables DEPVAR_ VARNAME_. * Rename variables containing the constant and the coefficient. rename variables CONST_=rurconst rurscore=rurcoeff. * Re-activate the main household data. dataset activate assets. * merge the coefficients. match files /file = * /table = ruralcorv /by ROWTYPE_. execute. dataset close urbancorv. dataset close ruralcorv. dataset activate assets. filter off. *** Calculate combined wealth score from Urban and Rural Scores. * Use coefficients from urban and rural regressions above. compute combscor=0. print formats combscor (f11.5). write formats combscor (f11.5). ** Urban. if (urban = 1) combscor=urbconst+urbcoeff*urbscore. ** Rural. if (rural = 1) combscor=rurconst+rurcoeff*rurscore. variable labels combscor 'Combined national wealth score'. execute. compute hhwt = QHWEIGHTN/1000000. variable labels hhwt 'HH weights'. formats hhwt (f12.6). weight by hhwt. filter off. execute. frequencies variables=combscor comscore /format=notable /ntiles=5 /statistics=stddev mean /histogram normal /order=analysis. filter off. filter by urban. execute. frequencies variables=combscor urbscore /format=notable /ntiles=5 /statistics=stddev mean /histogram normal /order=analysis. filter off. filter by rural. execute. frequencies variables=combscor rurscore /format=notable /ntiles=5 /statistics=stddev mean /histogram normal /order=analysis. filter off. execute. *Calculate quintiles and scores for data file. compute hhmemwt=QHWEIGHTN*hhusual/1000000. variable labels hhmemwt 'HH members weighting for index'. formats hhmemwt (f12.6). weight by hhmemwt. filter off. filter by urban. execute. rank variables=urbscore (A) /rank /ntiles (5) /print=yes /ties=mean. filter off. filter by rural. execute. rank variables=rurscore (A) /rank /ntiles (5) /print=yes /ties=mean. filter off. execute. rank variables=combscor (A) /rank /ntiles (5) /print=yes /ties=mean. variable labels ncombsco 'Combined wealth index' /nurbscor 'Urban wealth index' /nrurscor 'Rural wealth index'. value labels ncombsco nurbscor nrurscor 1 'Lowest' 2 'Second' 3 'Middle' 4 'Fourth' 5 'Highest'. *** Check on quintiles. frequencies variables=ncombsco nurbscor nrurscor. weight by hhwt. ctables /table ( QH25_11+QH25_12+QH25_13+QH25_21+QH25_31+QH25_32+QH25_41+QH25_42+QH25_51+QH25_61+QH25_71+QH25_81+QH25_91+QH25_92+QH25_96+ QH31_11+QH31_12+QH31_13+QH31_14+QH31_15+QH31_21+QH31_22+QH31_23+QH31_31+QH31_41+QH31_51+QH31_96+ QH31_11_sh+QH31_12_sh+QH31_13_sh+QH31_14_sh+QH31_15_sh+QH31_21_sh+QH31_22_sh+QH31_23_sh+QH31_31_sh+QH31_41_sh+QH31_96_sh+ QH37A+QH37B+QH37C+QH37D+QH37E+QH37F+QH37G+QH37H+QH37I+QH37J+QH37K+QH37L+QH37M+QH37N+QH37O+QH37P+QH37Q+QH37R+QH37S+QH37T+QH37U+QH37W+QH37X+QH37Y+QH37Z+QH37XA+ QH38_1+QH38_2+QH38_3+QH38_4+QH38_5+QH38_6+QH38_7+QH38_8+QH38_9+QH38_10+QH38_95+QH38_96+ QH42_11+QH42_12+QH42_13+QH42_21+QH42_22+QH42_23+QH42_24+QH42_31+QH42_32+QH42_33+QH42_34+QH42_35+QH42_36+QH42_96+ QH43_11+QH43_12+QH43_13+QH43_14+QH43_15+QH43_21+QH43_22+QH43_23+QH43_24+QH43_25+QH43_31+QH43_32+QH43_33+QH43_34+QH43_35+QH43_36+QH43_37+QH43_38+QH43_39+ QH43_96+QH44_11+QH44_12+QH44_13+QH44_14+QH44_21+QH44_22+QH44_23+QH44_24+QH44_25+QH44_26+QH44_31+QH44_32+QH44_33+QH44_34+QH44_35+QH44_36+QH44_96+ QH53+DOMESTHH+DOMESTIC+HOUSE+LAND+memsleep+ landarea+irrigated+QH52A+QH52B+QH52C+QH52D+QH52E+QH52F )[S][Mean F8.3] by (ncombsco+nurbscor+nrurscor)[C] /slabels visible=no. * Alternative instead of ctables. *means tables= QH25_11 QH25_12 QH25_13 QH25_21 QH25_31 QH25_32 QH25_41 QH25_42 QH25_51 QH25_61 QH25_71 QH25_81 QH25_91 QH25_92 QH25_96 QH31_11 QH31_12 QH31_13 QH31_14 QH31_15 QH31_21 QH31_22 QH31_23 QH31_31 QH31_41 QH31_51 QH31_96 QH31_11_sh QH31_12_sh QH31_13_sh QH31_14_sh QH31_15_sh QH31_21_sh QH31_22_sh QH31_23_sh QH31_31_sh QH31_41_sh QH31_96_sh QH37A QH37B QH37C QH37D QH37E QH37F QH37G QH37H QH37I QH37J QH37K QH37L QH37M QH37N QH37O QH37P QH37Q QH37R QH37S QH37T QH37U QH37W QH37X QH37Y QH37Z QH37XA QH38_1 QH38_2 QH38_3 QH38_4 QH38_5 QH38_6 QH38_7 QH38_8 QH38_9 QH38_10 QH38_95 QH38_96 QH42_11 QH42_12 QH42_13 QH42_21 QH42_22 QH42_23 QH42_24 QH42_31 QH42_32 QH42_33 QH42_34 QH42_35 QH42_36 QH42_96 QH43_11 QH43_12 QH43_13 QH43_14 QH43_15 QH43_21 QH43_22 QH43_23 QH43_24 QH43_25 QH43_31 QH43_32 QH43_33 QH43_34 QH43_35 QH43_36 QH43_37 QH43_38 QH43_39 QH43_96 QH44_11 QH44_12 QH44_13 QH44_14 QH44_21 QH44_22 QH44_23 QH44_24 QH44_25 QH44_26 QH44_31 QH44_32 QH44_33 QH44_34 QH44_35 QH44_36 QH44_96 QH53 DOMESTHH DOMESTIC HOUSE LAND memsleep landarea irrigated QH52A QH52B QH52C QH52D QH52E QH52F by ncombsco nurbscor nrurscor /cells mean count stddev. graph /histogram(normal)=combscor /title= 'Distribution of Households by Wealth Scores'. frequencies variables=combscor /format=notable /ntiles=5 /statistics=stddev minimum maximum semean mean median mode skewness seskew kurtosis sekurt /order=analysis. weight off. filter off. write formats combscor urbscore rurscore (f11.5). * Save final dataset of assets. save outfile='assets.sav'. *** Write out scores file. write outfile='scores.dat' table /QHPSU QHNUMBER combscor ncombsco urbscore nurbscor rurscore nrurscor. execute.