*** This is a simlpe SPSS SYNTAX example on how to create the consumption aggtregates. *** This file has been created for training purposes only . GET FILE='DIARY.SAV' / KEEP HHID REGION TYPE PRODUCT COICOP_G PAID_IN QUANTITY. ***We want to change the 6 digit coicop codes from the the format XX.X.X.X.X to format XXXXXX ***. String coicop6 (A6). comp coicop6= concat ( substr (coicop_g,1,2) , substr (coicop_g,4,1) , substr (coicop_g,6,1) , substr (coicop_g,8,1) , substr (coicop_g,10,1) ). **The diary contains some income information coded under coicopp group 00, we want to drop them. Select If (substr( coicop6 ,1,2)<>'00') . execute. **** We want to assing the category to each expenditure and categporize thenin 4 categories. ** 1 (Non durable) 2 (Service) 3 (Semi Durable) 4 (Durable). INCLUDE 'create_exp_type.sps'. ***This is a simple call for another Synatx , the details of calculation can be seen in it. *we neet to create separate group for explicit (estimated by the owner of the house / appartment) * and implicit (rear lents paid by renters) housing rents . if PRODUCT="4211" code2 ='13' /* implicit rent*/ . if PRODUCT="4112" code2 ='14' /* explicit rent*/ . *COMMENT --- These codes taken from PREM ECAPOV stata codes. if EXP_type = 4 code2 ='15' /* Expenditures on Durable goods*/ . ADD VALUE LABELS code2 13 'implicit rents' 14 'explicit rents ' 15 'expenditures on durable goods' . STRING code (A3). COMP Code = CONCAT ('C' ,code2 ). AGGREGATE /OUTFILE= * /BREAK=HHID Code /value 'Value of cumsumption in 15 days period' = SUM(PAID_IN). exec. * Reshape the long Diary to wide one and get the expenditures categories in a separate variables. * the In current format of the aggregated diary the Houshold has many oservations, * we want to have one observation (row in the data file ) per one Household. SORT CASES BY HHID code . CASESTOVARS /ID = HHID /INDEX = code /GROUPBY = VARIABLE . variable labels C01 ' Food and non-alcoholic beverages' /C02 ' Alcoholic beverages, robacco and narcotics' /C03 ' Clothing and footwear' /C04 ' Housing, water, electicity, gas and other fuels' /C05 ' Furnishing,household equipmentand routine maintenance of the house' /C06 ' Health' /C07 ' Transport' /C08 ' Communication ' /C09 ' Recreatio and culture' /C10 ' Education' /C11 ' Restaurants and hotels' /C12 ' Miscellaneous goods and services' . Variable labels C13 ' Housing implict rents' /C14 ' Housing Explicit rents' /C15 ' Expenditures on Durable goods' . recode all (sysmis =0). * Calculating monthy nominal consumption aggregate. * Monthy consumption excludes , health expenditures , rents and expenditures on durable goods. Compute totconsm = sum(C01, c02 , c03 ,c04,c05, c07,c08 ,c09, c10, c11,c12 ) * 2 . Variable label totconsm 'Monthy consumption '. exec.