set more off clear all set mem 500m *tell stata where you saved your data global data "C:\EICV2_SAV" global EICV4 "C:\EICV 2014" *tell stata where you want to save the outputs cd "C:\outputs" *Log outputs cap log close log using EICV2.log, replace ***CONSTRUCTING CONSUMPTION AGGREGATES **YEARLY NON-FOOD usespss using "$data\eng_eicv2_s9a1_nfood_annual.sav" , clear **replace missing values *amount purchased bysort ID1_N ITEM: egen medspd = median (S9A1Q3) replace S9A1Q3 = medspd if ((S9A1Q3>=. | S9A1Q3==0) & S9A1Q2==1) *aggregate collapse (sum) nfyr=S9A1Q3, by(KEY) tempfile nfyr save `nfyr' **MONTHLY NON-FOOD usespss using "$data\eng_eicv2_s9a2_nfood_month.sav" , clear **replace missing values *amount purchased bysort ID1_N ITEM: egen medspd = median (S9A2Q3) replace S9A2Q3 = medspd if ((S9A2Q3>=. | S9A2Q3==0) & S9A2Q2==1) *aggregate collapse (sum) S9A2Q3, by(KEY) gen nfmth = 12 *S9A2Q3 tempfile nfmt save `nfmt' **WEEKLY NONFOOD usespss using "$data\eng_eicv2_s9a3_nfood_freq.sav" , clear egen spend = rowtotal( S9A3Q4 -S9A3Q13), m replace spend = 2* spend if (ID1_N==1 & ID0==2) | ID1_N>1 //recall priod is 30 days in Kigali city and 14 elsewhere// not sure if this applies to nonfood, but it gives me the right result **replace missing values *months purchased bysort ID1_N ITEM: egen medmth = median (S9A3Q3) // replace S9A3Q3 = medmth if ((S9A3Q3>=. | S9A3Q3==0) & S9A3Q2==1) *amount purchased bysort ID1_N ITEM: egen medspd = mean (spend) // Im using mean hear to get similar results to official cons ag replace spend = medspd if ((spend>=. | spend==0) & S9A3Q2==1) **Aggregate gen nfwk = spend * S9A3Q3 collapse (sum) nfwk, by(KEY) tempfile nfwk save `nfwk' **FOOD *usespss using "$data\S09B.sav" , clear usespss using "$data\eng_eicv2_s9b_food.sav" , clear egen spend = rowtotal (EXP13P) //( S9BQ4 -S9BQ13), m replace spend = 2* spend if (ID1_N==1 & ID0==2) | ID1_N>1 //recall priod is 30 days in Kigali city and 14 elsewhere **replace missing values *months purchased bysort ID1_N ITEM: egen medmth = mean (12) //mean(S9BQ3) if S9BQ2==1 gen S9BQ3 = . //i add this for lack replace S9BQ3 = medmth //if ((S9BQ3>=. | S9BQ3==0) & S9BQ2==1) *amount purchased bysort ID1_N ITEM: egen medspd = mean (spend) //if S9BQ2==1 replace spend = medspd if ((spend>=. | spend==0) ) //& S9BQ2==1) *aggregate gen food = spend //* S9BQ3 *rename D9B TXT decode ITEM , gen(TXT) sort KEY ITEM tempfile foodqty save `foodqty' save foodqty05, replace collapse (sum) food , by(KEY) tempfile food save `food' **AUTO-CONSUMPTION (annualised) usespss using "$data\eng_eicv2_s9d_ex_owncons.sav" , clear *Hamrmonize with food label drop ITEM replace ITEM = 1000* 1 if ITEM == 1 replace ITEM = 1000* 3 if ITEM == 2 replace ITEM = 1000* 4 if ITEM == 3 replace ITEM = 1000* 5 if ITEM == 4 replace ITEM = 1000* 7 if ITEM == 5 replace ITEM = 1000* 8 if ITEM == 6 replace ITEM = 1000* 9 if ITEM == 7 replace ITEM = 1000* 10 if ITEM == 8 replace ITEM = 1000* 11 if ITEM == 9 replace ITEM = 1000* 12 if ITEM == 10 replace ITEM = 1000* 13 if ITEM == 11 replace ITEM = 1000* 18 if ITEM == 12 replace ITEM = 1000* 19 if ITEM == 13 replace ITEM = 1000* 20 if ITEM == 14 replace ITEM = 1000* 21 if ITEM == 15 replace ITEM = 1000* 22 if ITEM == 16 replace ITEM = 1000* 23 if ITEM == 17 replace ITEM = 1000* 24 if ITEM == 18 replace ITEM = 1000* 26 if ITEM == 19 replace ITEM = 1000* 27 if ITEM == 20 replace ITEM = 1000* 28 if ITEM == 21 replace ITEM = 1000* 29 if ITEM == 22 replace ITEM = 1000* 32 if ITEM == 23 replace ITEM = 1000* 33 if ITEM == 24 replace ITEM = 1000* 38 if ITEM == 25 replace ITEM = 1000* 39 if ITEM == 26 replace ITEM = 1000* 43 if ITEM == 28 replace ITEM = 1000* 44 if ITEM == 31 replace ITEM = 1000* 45 if ITEM == 32 replace ITEM = 1000* 44 if ITEM == 33 replace ITEM = 1000* 46 if ITEM == 35 replace ITEM = 1000* 47 if ITEM == 36 replace ITEM = 1000* 48 if ITEM == 37 replace ITEM = 1000* 49 if ITEM == 38 replace ITEM = 1000* 50 if ITEM == 39 replace ITEM = 1000* 51 if ITEM == 40 replace ITEM = 1000* 52 if ITEM == 41 replace ITEM = 1000* 53 if ITEM == 42 replace ITEM = 1000* 54 if ITEM == 43 replace ITEM = 1000* 56 if ITEM == 44 replace ITEM = 1000* 57 if ITEM == 45 replace ITEM = 1000* 58 if ITEM == 46 replace ITEM = 1000* 59 if ITEM == 47 replace ITEM = 1000* 60 if ITEM == 48 replace ITEM = 1000* 62 if ITEM == 49 replace ITEM = 1000* 63 if ITEM == 50 replace ITEM = 1000* 64 if ITEM == 51 replace ITEM = 1000* 65 if ITEM == 52 replace ITEM = 1000* 64 if ITEM == 53 replace ITEM = 1000* 67 if ITEM == 54 replace ITEM = 1000* 68 if ITEM == 55 replace ITEM = 1000* 69 if ITEM == 56 replace ITEM = 1000* 71 if ITEM == 57 replace ITEM = 1000* 72 if ITEM == 58 replace ITEM = 1000* 73 if ITEM == 59 replace ITEM = 1000* 74 if ITEM == 60 replace ITEM = 1000* 75 if ITEM == 61 replace ITEM = 1000* 76 if ITEM == 62 replace ITEM = 1000* 77 if ITEM == 63 replace ITEM = 1000* 78 if ITEM == 64 replace ITEM = 1000* 79 if ITEM == 65 replace ITEM = 1000* 80 if ITEM == 66 replace ITEM = 1000* 81 if ITEM == 67 replace ITEM = 1000* 82 if ITEM == 68 replace ITEM = 1000* 88 if ITEM == 69 replace ITEM = 1000* 83 if ITEM == 70 replace ITEM = 1000* 84 if ITEM == 71 replace ITEM = 1000* 85 if ITEM == 72 replace ITEM = 1000* 86 if ITEM == 73 replace ITEM = 1000* 87 if ITEM == 74 replace ITEM = 1000* 88 if ITEM == 75 replace ITEM = 1000* 89 if ITEM == 76 replace ITEM = 1000* 90 if ITEM == 77 replace ITEM = 1000* 91 if ITEM == 78 replace ITEM = 1000* 92 if ITEM == 79 replace ITEM = 1000* 93 if ITEM == 80 replace ITEM = 1000* 94 if ITEM == 81 replace ITEM = 1000* 95 if ITEM == 82 replace ITEM = 1000* 96 if ITEM == 83 replace ITEM = 1000* 97 if ITEM == 84 replace ITEM = 1000* 98 if ITEM == 85 replace ITEM = 1000* 99 if ITEM == 86 replace ITEM = 1000* 100 if ITEM == 87 replace ITEM = 1000* 101 if ITEM == 88 replace ITEM = 1000* 102 if ITEM == 89 replace ITEM = 1000* 106 if ITEM == 90 replace ITEM = 1000* 105 if ITEM == 91 replace ITEM = 1000* 111 if ITEM == 92 replace ITEM = 1000* 116 if ITEM == 93 replace ITEM = 1000* 119 if ITEM == 94 replace ITEM = 1000* 121 if ITEM == 95 replace ITEM = 1000* 124 if ITEM == 96 replace ITEM = 1000* 125 if ITEM == 97 replace ITEM = 1000* 128 if ITEM == 99 replace ITEM = 1000* 130 if ITEM == 100 replace ITEM = 1000* 131 if ITEM == 101 replace ITEM = 1000* 132 if ITEM == 102 replace ITEM = 1000* 153 if ITEM == 103 replace ITEM = 1000* 154 if ITEM == 104 replace ITEM = 1000* 155 if ITEM == 105 replace ITEM = 1000* 156 if ITEM == 106 replace ITEM = ITEM/1000 egen spend = rowtotal( S9DQ4 -S9DQ13), m replace spend = 2* spend if (ID1_N==1 & ID0==2) | ID1_N>1 //recall priod is 30 days in Kigali city and 14 elsewhere **replace missing values *months purchased bysort ID1_N ITEM: egen medmth = mean (S9DQ3) if S9DQ2==1 replace S9DQ3 = medmth if ((S9DQ3>=. | S9DQ3==0) & S9DQ2==1) *amount purchased bysort ID1_N ITEM: egen medspd = mean (spend) if S9DQ2==1 replace spend = medspd if ((spend>=. | spend==0) & S9DQ2==1) *price purchased bysort ID1_N ITEM: egen medprc = median (S9DQ15) if S9DQ2==1 replace S9DQ15 = medprc if ((S9DQ15>=. | S9DQ15==0) & S9DQ2==1) *aggregate gen auto = spend * S9DQ3 *S9DQ15 gen autonf=spend * S9DQ3 *S9DQ15 if ITEM>=153 & ITEM<=156 *decode ITEM , gen(TXT) *replace TXT = "Banana fruit (Iminek" if TXT== "Banana fruit (Iminik" *replace TXT = "Sheep, mutton or lamb" if TXT== "Sheep /Mutton / lamb" *Put all unit prices in comparable units (kg) replace S9DQ15 = S9DQ15*3 if S9DQ14==1 replace S9DQ15 = S9DQ15*2 if S9DQ14==2 replace S9DQ15 = S9DQ15*1 if S9DQ14==3 replace S9DQ15 = S9DQ15*1 if S9DQ14==4 replace S9DQ15 = S9DQ15*.3 if S9DQ14==5 replace S9DQ15 = S9DQ15*.2 if S9DQ14==7 replace S9DQ15 = S9DQ15*.25 if S9DQ14==11 replace S9DQ15 = S9DQ15*.33 if S9DQ14==12 replace S9DQ15 = S9DQ15*.25 if S9DQ14==13 replace S9DQ15 = S9DQ15*.25 if S9DQ14==14 replace S9DQ15 = S9DQ15* 4 if S9DQ14==15 replace S9DQ15 = S9DQ15* 2 if S9DQ14==16 replace S9DQ15 = S9DQ15*.01 if S9DQ14==17 replace S9DQ15 = S9DQ15*.25 if S9DQ14==18 replace S9DQ15 = S9DQ15* 4 if S9DQ14==22 replace S9DQ15 = S9DQ15* 5 if S9DQ14==23 replace S9DQ15 = S9DQ15* 10 if S9DQ14==25 replace S9DQ15 = S9DQ15* 5 if S9DQ14==26 replace S9DQ15 = S9DQ15*20 if S9DQ14==31 replace S9DQ15 = S9DQ15*1 if S9DQ14==36 replace S9DQ15 = S9DQ15*3 if S9DQ14==33 & (ITEM<35 | ITEM>37) replace S9DQ15 = S9DQ15/4 if S9DQ14==33 & (ITEM>34 & ITEM<38) replace S9DQ15 = S9DQ15*2.5 if S9DQ14==34 collapse (sum) auto* spend (median) HH_WT S9DQ3 S9DQ14 S9DQ15 S9DQ2, by(KEY ITEM) duplicates drop KEY ITEM, force *gen idu=_n tempfile autoqty save `autoqty' save autoqty05, replace collapse (sum) auto* (mean) HH_WT, by(KEY) tempfile auto save `auto' **TRANSFERS OUT (yearly) usespss using "$data\eng_eicv2_s10a_transfer_out.sav" , clear *aggregate egen trfout = rowtotal(S10AQ9 S10AQ10), m collapse (sum) trfout, by(KEY) tempfile trfout save `trfout' **TRANSFERS IN (yearly) usespss using "$data\eng_eicv2_s10b_transfer_in.sav" , clear *aggregate egen trfin = rowtotal(S10BQ9 S10BQ10), m collapse (sum) trfin, by(KEY) tempfile trfin save `trfin' **SOCIAL PROTECTION (yearly) usespss using "$data\eng_eicv2_s10c_misc.sav" , clear gen social =S10CQ2 if ITEM==5 //check *aggregate collapse (sum) social, by(KEY) tempfile social save `social' **DURABLES (annualised) usespss using "$data\eng_eicv2_s11b_durables.sav" , clear *calculate average age of durables gen art1 = 12* S11BQ3A //2011 + 6 - (12* S11BQ3AY ) //+ S11BQ3AM) for comparability with 2014, we remove month gen art2 = 12* S11BQ3B //2011 + 6 - (12* S11BQ3BY ) //+ S11BQ3BM) gen art3 = 12* S11BQ3C //2011 + 6 - (12* S11BQ3CY ) //+ S11BQ3CM) //S11BQ3C1 + S11BQ3C replace art1 = 12 if art1==98 replace art2 = 12 if art2==98 replace art3 = 12 if art3==98 egen avgage = rowmean(art1 art2 art3), bysort ITEM: egen medage = median (avgage) *calculate the flow value of durables gen prc1 = S11BQ5A / (2*medage/12) //1.6 is to get similar numbers as in official estimates gen prc2 = S11BQ5B / (2*medage/12) gen prc3 = S11BQ5C / (2*medage/12) *impute missing values forval i=1/3 { bysort ITEM: egen medprc`i' = median (prc`i') replace prc`i' = medprc`i' if prc`i'==. & art`i'!=. } egen durables = rowtotal(prc1 prc2 prc3), *aggregate collapse (sum) durables, by(KEY) tempfile durables save `durables' *HEALTH / EDUCATION usespss using "$data\eng_eicv2_s2_education.sav" , clear tempfile educ save `educ' usespss using "$data\eng_eicv2_s3_health.sav" , clear tempfile health save `health' usespss using "$data\eng_eicv2_s4_migration.sav" , clear merge 1:1 KEY PID using `health', nogen merge 1:1 KEY PID using `educ' , nogen *health egen health1 = rowtotal( S3AQ16 S3AQ17 S3AQ19 S3AQ20 S3AQ22 S3AQ23 S3AQ26 S3AQ27 S3CQ7), m //15 28 gen health = 24* health1 *education egen educ = rowtotal(S2AQ10A-S2AQ10G ), m //H S2CQ7 S2CQ8 S2DQ14 S2DQ15 *travel gen travel = 0 //rowtotal(S4BQ9A - S4BQ9H), m *aggregate collapse (sum) health educ travel, by(KEY) tempfile hltedu save `hltedu' *RENT / UTILITIES usespss using "$data\eng_eicv2_s5_housing.sav" , clear *egen estrnt = cond(S5BQ3B==1, S5BQ3A*12,0)+cond(S5BQ3B==2, S5BQ3A*4,0)+cond(S5BQ3B==3, S5BQ3A*1,0) *gen actrnt = cond(S5BQ4B==1, S5BQ4A*12,0)+cond(S5BQ4B==2, S5BQ4A*4,0)+cond(S5BQ4B==3, S5BQ4A*1,0) egen mrent = rowtotal(S5BQ1 S5BQ2 S5BQ4A ) //estrnt actrnt S5BQ9), m gen rent = mrent *12 egen house= rowtotal( S5BQ10 S5BQ8A ), m // does include construction cost S5CQ10 for new house gen prvwat= 0 //4*S5CQ5 gen mntwat= S5CQ2A *(12/(S5CQ2B*2)) // gen conwat= 12*S5CQ3 egen water= rowtotal( mntwat prvwat conwat), m gen elect= 12*S5CQ7A replace elect = elect/2 if S5CQ7B>1 *aggregate collapse (sum) rent house water elect, by(KEY) tempfile house save `house' *WAGES IN KIND usespss using "$data\eng_eicv2_s6e_employ_wages.sav" , clear gen ikfood = cond(S6EQ10T==1, S6EQ10 *240,0) + cond(S6EQ10T==2, S6EQ10 *50,0) + cond(S6EQ10T==3, S6EQ10 *12,0) + cond(S6EQ10T==4, S6EQ10 *1,0) gen ikhous = cond(S6EQ12T==1, S6EQ12 *240,0) + cond(S6EQ12T==2, S6EQ12 *50,0) + cond(S6EQ12T==3, S6EQ12 *12,0) + cond(S6EQ12T==4, S6EQ12 *1,0) gen ikothr = cond(S6EQ14T==1, S6EQ14 *240,0) + cond(S6EQ14T==2, S6EQ14 *50,0) + cond(S6EQ14T==3, S6EQ14 *12,0) + cond(S6EQ14T==4, S6EQ14 *1,0) egen wages = rowtotal(ikfood ikhous ikothr), m *aggregate collapse (sum) wages ikfood, by(KEY) tempfile wages save `wages' ***ADULT EQUIVALENCE (SEE REPORT) usespss using "$data\eng_eicv2_s1_demo.sav" , clear /*use "$EICV4\EICV3_Povertyfile_Jan2014.dta", clear rename ae adeqtot rename hhid KEY rename member NMBREX gen idx = cons1_ae / sol //get price index by dividing the adjusted consumption aggregate by the raw aggregate keep KEY adeq adeqtot idx NMBREX */ gen adeq = . *males replace adeq = .41 if S1Q1==1 & S1Q3A<1 replace adeq = .56 if S1Q1==1 & S1Q3A>=1 & S1Q3A<4 replace adeq = .76 if S1Q1==1 & S1Q3A>=4 & S1Q3A<7 replace adeq = .91 if S1Q1==1 & S1Q3A>=7 & S1Q3A<10 replace adeq = .97 if S1Q1==1 & S1Q3A>=10 & S1Q3A<13 replace adeq = .97 if S1Q1==1 & S1Q3A>=13 & S1Q3A<16 replace adeq =1.02 if S1Q1==1 & S1Q3A>=16 & S1Q3A<20 replace adeq =1.00 if S1Q1==1 & S1Q3A>=20 & S1Q3A<40 replace adeq = .95 if S1Q1==1 & S1Q3A>=40 & S1Q3A<50 replace adeq = .90 if S1Q1==1 & S1Q3A>=50 & S1Q3A<60 replace adeq = .80 if S1Q1==1 & S1Q3A>=60 & S1Q3A<70 replace adeq = .70 if S1Q1==1 & S1Q3A>=70 & S1Q3A<. *females replace adeq = .41 if S1Q1==2 & S1Q3A<1 replace adeq = .56 if S1Q1==2 & S1Q3A>=1 & S1Q3A<4 replace adeq = .76 if S1Q1==2 & S1Q3A>=4 & S1Q3A<7 replace adeq = .91 if S1Q1==2 & S1Q3A>=7 & S1Q3A<10 replace adeq =1.08 if S1Q1==2 & S1Q3A>=10 & S1Q3A<13 replace adeq =1.13 if S1Q1==2 & S1Q3A>=13 & S1Q3A<16 replace adeq =1.05 if S1Q1==2 & S1Q3A>=16 & S1Q3A<20 replace adeq =1.00 if S1Q1==2 & S1Q3A>=20 & S1Q3A<40 replace adeq = .95 if S1Q1==2 & S1Q3A>=40 & S1Q3A<50 replace adeq = .90 if S1Q1==2 & S1Q3A>=50 & S1Q3A<60 replace adeq = .80 if S1Q1==2 & S1Q3A>=60 & S1Q3A<70 replace adeq = .70 if S1Q1==2 & S1Q3A>=70 & S1Q3A<. gen NMBREX = 1 collapse (sum) adeqtot= adeq NMBREX, by(KEY) tempfile adeq save `adeq' ***************************************************** ************P R I C E I N D E X ******************* ***************************************************** *NOTE THAT PRICES IN EICV2 ARE NOT OF GOOD ENOUGH QUALITY FOR A PRICE INDEX* usespss using "$data\eng_eicv2_s1_demo.sav", clear collapse (count) hhsize=PID (mean) HH_WT ID1_N if S1Q13==1, by(KEY) tempfile ind save `ind' usespss using "$data\eng_eicv2_s0_id.sav", clear keep KEY S0Q16B rename S0Q16B MONTH replace MONTH=1 if MONTH==2 | MONTH==3 replace MONTH=4 if MONTH==5 | MONTH==6 replace MONTH=7 if MONTH==8 | MONTH==9 replace MONTH=10 if MONTH==11 | MONTH==12 tempfile month save `month' merge 1:m KEY using `autoqty', nogen merge m:1 KEY using `ind', nogen gen p = S9DQ15 replace MONTH = 0 if MONTH==. tempfile temp save `temp', replace keep if S9DQ15!=. *tab1 urban ID1_N region, m collapse (count) S9DQ15, by(ID1_N MONTH ITEM) rename S9DQ15 px tab px, m drop if px==0 gen uq = ID1_N*100 + MONTH drop ID1_N MONTH reshape wide px, i(ITEM) j(uq) egen xmin = rowmin(px*) foreach n of numlist 5 10 20 30 50 100 150 { cap count if xmin>=`n' } cap count if xmin>=10 gen tmpprc = 1 keep ITEM tmpprc sort ITEM tempfile tmpprc save `tmpprc', replace *shares use `temp', clear sort KEY ITEM merge 1:1 KEY ITEM using `foodqty', nogen sort ITEM rename food fd merge m:1 ITEM using `tmpprc' drop _merge sort KEY ITEM egen exp = rowtotal(auto fd) replace exp = exp/12 gen double expin = exp if tmpprc==1 egen double expinhh = sum(expin), by(KEY) egen double expallhh = sum(exp), by(KEY) gen sharein = expinhh/expallhh*100 bys KEY : gen first = cond(_n==1,1,0) drop expin expinhh expallhh sharein first * pluto share by ID1_N egen double xsharei = sum(exp*HH_WT) if tmpprc==1, by(ID1_N MONTH) egen double xtoti = sum(exp*HH_WT), by(ID1_N MONTH) gen yi = xsharei/xtoti*100 * pluto share- national egen double xshare = sum(exp*HH_WT), by(tmpprc) egen double xtot = sum(exp*HH_WT) gen y = xshare/xtot*100 drop xsharei xtoti yi xshare xtot y keep if tmpprc==1 count gen px= S9DQ15 tempfile tempEICVtmpprc save `tempEICVtmpprc', replace use `tempEICVtmpprc', clear collapse (median) S9DQ15 [aw=HH_WT], by(ID1_N MONTH ITEM) rename S9DQ15 pi replace MONTH = 0 if MONTH==. * median prices preserve reshape wide pi, i(ITEM ID1_N) j(MONTH) restore rename pi piEICV describe sort ID1_N MONTH ITEM tempfile foodpiEICV save `foodpiEICV', replace use `tempEICVtmpprc', clear collapse (median) S9DQ15 [aw=HH_WT], by(ITEM) rename S9DQ15 p0 rename p0 p0EICV sort ITEM tempfile foodp0EICV save `foodp0EICV', replace *weights use `tempEICVtmpprc', clear rename exp food collapse (sum) food, by(KEY ITEM) reshape wide food, i(KEY) j(ITEM) sort KEY qui recode food* (.=0) * "demo" shares reshape long food, i(KEY) j(code) egen totalff = sum(food), by(KEY) gen double share = food/totalff * excluding households without expenditure summ if share==. egen x = group(KEY) if share==. drop x drop if share==. drop food totalff reshape wide share, i(KEY) j(code) merge 1:1 KEY using `ind' drop if _==2 drop _m sort KEY tempfile foodvEICV save `foodvEICV', replace *national shares use `foodvEICV', clear collapse (mean) share* [aw=HH_WT*hhsize] gen id=1 reshape long share, i(id) j(ITEM) rename share share0EICV drop id sort ITEM tempfile shares0EICV save `shares0EICV', replace *shares use `foodvEICV', clear merge 1:1 KEY using `month', nogen collapse (mean) share* [aw=HH_WT*hhsize], by(ID1_N MONTH) reshape long share, i(ID1_N MONTH) j(ITEM) rename share shareiEICV sort ID1_N MONTH ITEM tempfile sharesiEICV save `sharesiEICV', replace *merge use `foodpiEICV', clear sort ITEM merge m:1 ITEM using `foodp0EICV' drop _merge sort ID1_N MONTH ITEM merge 1:1 ID1_N MONTH ITEM using `sharesiEICV' drop _merge sort ITEM merge m:1 ITEM using `shares0EICV' drop _merge sort ITEM ID1_N MONTH gen cpiL = share0EICV*piEICV/p0EICV gen cpiP = shareiEICV*p0EICV/piEICV collapse (sum) cpi*, by(ID1_N MONTH) *indices gen laspeyres = cpiL gen paasche = 1/cpiP gen fisher = (laspeyres*paasche)^0.5 drop cpi* sort ID1_N MONTH gen idx = laspeyres //fisher tempfile price save `price' *********************************************** ***MATCHING NAMES FOR POVLINE***************** ********************************************* drop _all set obs 143 gen idu = _n gen TXT = "" replace TXT = "Corn (flour)" in 1 replace TXT = "Dry maize (grain)" in 2 replace TXT = "Local rice" in 3 replace TXT = "Sorghum" in 4 replace TXT = "Sorghum(flour)" in 5 replace TXT = "Sorghum (flour)" in 6 replace TXT = "Eggs" in 7 replace TXT = "Fish (dry / smoked)" in 8 replace TXT = "Avocado" in 9 replace TXT = "Banana - cooking (Inyamunyo)" in 10 replace TXT = "Banana fruit (Imineke)" in 11 replace TXT = "Local banana juice" in 12 replace TXT = "Mangos" in 13 replace TXT = "Orange (local)" in 14 replace TXT = "Papayas" in 15 replace TXT = "Pineapple" in 16 replace TXT = "Beef meat" in 17 replace TXT = "Chicken live" in 18 replace TXT = "Other Meats" in 19 //| TXT =" in 1Goat meat" in 1 | TXT = "Rabbit Meat" in 1 | TXT = "Sausages, bacon etc" in 1 replace TXT = "Pork meat" in 20 replace TXT = "Sheep, mutton or lamb meat" in 21 replace TXT = "Curdled Milk" in 22 replace TXT = "Fresh milk" in 23 replace TXT = "Dry beans" in 24 replace TXT = "Cassava (fermented)" in 25 replace TXT = "Cassava (flour)" in 26 replace TXT = "Cassava (root)" in 27 replace TXT = "Irish Potato" in 28 replace TXT = "Sweet potato" in 29 replace TXT = "Tarot/amateke" in 30 replace TXT = "Ground nuts (peanuts)" in 31 replace TXT = "Soya (dry)" in 32 replace TXT = "Amarante (large leafed green)" in 33 replace TXT = "Amarante (small leafed green)" in 34 replace TXT = "Cabbages" in 35 replace TXT = "Carrot" in 36 replace TXT = "Cassava leaves" in 37 replace TXT = "Eggplant" in 38 replace TXT = "Yams/Ibikoro" in 39 //" in 1Ibishayote" in 1 replace TXT = "Lettuce" in 40 replace TXT = "Onion" in 41 replace TXT = "Pumpkin" in 42 replace TXT = "Tomato" in 43 replace TXT = "Banana - beer (Ikakama/Inkashi)" in 44 replace TXT = "Berries" in 45 replace TXT = "Bread" in 46 replace TXT = "Carbonated Soft Drin" in 47 replace TXT = "Celery" in 48 replace TXT = "Citron - Lemon" in 49 replace TXT = "Coffee (local)" in 50 replace TXT = "Cucumber" in 51 replace TXT = "Fish (fresh / frozen)" in 52 replace TXT = "Fresh bean" in 53 replace TXT = "Garlic" in 54 replace TXT = "Goat meat" in 55 replace TXT = "Green pea (dry)" in 56 replace TXT = "Green pea (fresh)" in 57 replace TXT = "Groundnut flour" in 58 replace TXT = "Guava" in 59 replace TXT = "Honey" in 60 replace TXT = "Imported rice" in 61 replace TXT = "Lard of pork" in 62 replace TXT = "Leeks" in 63 replace TXT = "Local Banana beer" in 64 replace TXT = "Local sorghum beer(ikigage)" in 65 replace TXT = "Maize (fresh)" in 66 replace TXT = "Maracouja" in 67 replace TXT = "Milk powder" in 68 replace TXT = "Millet (flour)" in 69 replace TXT = "Mushrooms" in 70 replace TXT = "Other flours of cereals," in 71 replace TXT = "Other Vegetables" in 72 replace TXT = "Other plant oils" in 73 replace TXT = "Other tubers" in 74 replace TXT = "Palm oil" in 75 replace TXT = "Parsley" in 76 replace TXT = "Passion fruit juice" in 77 replace TXT = "Pasta" in 78 replace TXT = "Peanut oil" in 79 replace TXT = "Pepper" in 80 replace TXT = "Pepper-raw" in 81 replace TXT = "Plums" in 82 replace TXT = "Rabbit Meat" in 83 replace TXT = "Small Sized Fish" in 84 replace TXT = "Sorghum" in 85 replace TXT = "Sorghum (flour)" in 86 replace TXT = "Sorghum juice(Ubushera)" in 87 replace TXT = "Soya (fresh)" in 88 replace TXT = "Soya Flour" in 89 replace TXT = "Spinach" in 90 replace TXT = "String bean" in 91 replace TXT = "Sugar (imported)" in 92 replace TXT = "Sugar (local)" in 93 replace TXT = "Sugarcane" in 94 replace TXT = "Tea (imported)" in 95 replace TXT = "Tea (local)" in 96 replace TXT = "Wheat (flour)" in 97 replace TXT = "Wheat (grain)" in 98 replace TXT = "Wild Meat" in 99 replace TXT = "Yams/Ibikoro" in 100 replace TXT = "Yogurt" in 101 tempfile names save names, replace ***CONSUMPTION AGGREGATES *merge usespss using "$data\eng_eicv2_s0_id.sav" , clear merge 1:1 KEY using `nfyr', nogen merge 1:1 KEY using `nfmt', nogen merge 1:1 KEY using `nfwk', nogen merge 1:1 KEY using `food', nogen merge 1:1 KEY using `auto', nogen merge 1:1 KEY using `trfin', nogen merge 1:1 KEY using `trfout', nogen merge 1:1 KEY using `social', nogen merge 1:1 KEY using `durables', nogen merge 1:1 KEY using `hltedu', nogen merge 1:1 KEY using `house', nogen merge 1:1 KEY using `wages', nogen merge 1:1 KEY using `adeq', nogen gen MONTH = cond(S0Q16B==2 | S0Q16B==3 | S0Q16B==1, 1, 0) + cond(S0Q16B==5 | S0Q16B==6 | S0Q16B==4, 4, 0) + cond(S0Q16B==8 | S0Q16B==9 | S0Q16B==7, 7, 0) + cond(S0Q16B==11 | S0Q16B==12 | S0Q16B==10, 10, 0) merge m:1 MONTH ID1_N using `price', nogen save "merged05.dta", replace use "merged05.dta", clear *remove items already included elsewhere or no desirable replace health = 0 replace house = 0 replace trfout = 0 replace travel = 0 **adult equivalence foreach var in nfyr nfmt nfwk food auto trfin trfout social durables health educ travel rent house water elect wages { gen ad`var' = `var' / adeqtot gen ln`var' = ln(ad`var') if ad`var'>0 replace ln`var'= 0 if ln`var'==. } **aggregate egen total = rowtotal(nfyr nfmt nfwk food auto trfin trfout social durables health educ travel rent house water elect wages ), m ** remove outliers foreach var in nfyr nfmt nfwk food auto trfin trfout social durables health educ travel rent house water elect wages { *exceptional expnditures replace ln`var'= . if ln`var'==0 bysort ID1_N: egen mn`var' = mean(ad`var') bysort ID1_N: egen mu`var' = mean(ln`var') bysort ID1_N: egen sd`var' = sd(ln`var') gen outl`var'= (ln`var'>mu`var'+3.5*sd`var') if ln`var'<. replace ad`var' = mn`var' if outl`var'==1 } replace nfyr = . if nfyr>20000000 //manually removing some outliers to get same results as official egen adtot = rowtotal(ad* ), m foreach var in nfyr nfmt nfwk food auto trfin trfout social durables health educ travel rent house water elect wages { gen shrad`var' = ad`var' / adtot } gen prcadtot = adtot / idx // price adjusted consumption aggregate ********POVERTY LINE********** preserve keep MONTH KEY HH_WT prcadtot adfood adauto adtrfin adwages adtot adeqtot NMBREX autonf CLUST *share of non-food xtile decile = prcadtot [aw=HH_WT*NMBREX], n(10) // egen foodtot = rowtotal(adfood adauto adtrfin adwages) replace foodtot= foodtot - (autonf / adtot) gen foodshr = foodtot /adtot sum foodshr [iw=HH_WT*NMBREX] if decile == 5 // local foodshr = r(mean) *quantites duplicates drop KEY, force merge 1:m KEY using foodqty05, nogen drop spend duplicates drop KEY ITEM, force merge 1:1 KEY ITEM using autoqty05, update // collapse (sum) food auto spend (median) MONTH HH_WT NMBREX adeqtot S9DQ15 S9DQ14 S9DQ3 ID1_N ITEM ID0 , by(KEY TXT) //price weight *replace missing prices *replace S9DQ15 =. if (S9DQ14!=30 & S9DQ14!=32 & S9DQ14!=36) //remove prices in non-standard units bysort ID1_N MONTH ITEM: egen medprcpro = median (S9DQ15) replace S9DQ15 = medprcpro if ((S9DQ15>=. | S9DQ15==0)) *here we calculate the daily qty expended on different items egen foodval = rowtotal(food ) // gen foodqty = (foodval /365) / S9DQ15 //price gen foodqae1 = foodqty / adeqtot // replace foodqae1 = 0 if foodqae1==. *gen autoqty = (S9DQ3*spend) / 365 gen autoqty = (auto / 365) / S9DQ15 // replace autoqty =0 if autoqty==. gen autoqae1 = autoqty / adeqtot // egen foodqae = rowtotal(foodqae1 autoqae1), m collapse (mean) foodqae (median) S9DQ15 ITEM ID0 [iw=HH_WT * NMBREX], by(TXT) //(median) price = S9CQ15 weight gen foodshr = `foodshr' gen idm = _n reclink TXT using names, gen(myscore) idm(idm) idu(idu) wmatch(10) wnomatch(10) rename TXT TXTeicv2 rename UTXT TXT *Importing kcal per 100g from 2014 table B4 gen kcalper100g =. replace kcalper100g = 363 if TXT=="Corn (flour)" replace kcalper100g = 356 if TXT=="Dry maize (grain)" replace kcalper100g = 280 if TXT=="Local rice" replace kcalper100g = 343 if TXT=="Sorghum" replace kcalper100g = 343 if TXT=="Sorghum (flour)" replace kcalper100g = 139 if TXT=="Eggs" replace kcalper100g = 199 if TXT=="Fish (dry / smoked)" replace kcalper100g = 119 if TXT=="Avocado" replace kcalper100g = 75 if TXT=="Banana - cooking (Inyamunyo)" replace kcalper100g = 60 if TXT=="Banana fruit (Imineke)" replace kcalper100g = 48 if TXT=="Local banana juice" replace kcalper100g = 45 if TXT=="Mangos" replace kcalper100g = 34 if TXT=="Orange (local)" replace kcalper100g = 26 if TXT=="Papayas" replace kcalper100g = 26 if TXT=="Pineapple" replace kcalper100g = 150 if TXT=="Beef meat" replace kcalper100g = 122 if TXT=="Chicken live" replace kcalper100g = 126 if TXT=="Other Meats" //| TXT =="Goat meat" //| TXT=="Rabbit Meat" | TXT=="Sausages, bacon etc" // //////////////////////////////////////////////////////////// replace kcalper100g = 220 if TXT=="Pork meat" replace kcalper100g = 263 if TXT=="Sheep, mutton or lamb meat" replace kcalper100g = 75 if TXT=="Curdled Milk" replace kcalper100g = 61 if TXT=="Fresh milk" replace kcalper100g = 341 if TXT=="Dry beans" replace kcalper100g = 362 if TXT=="Cassava (fermented)" replace kcalper100g = 338 if TXT=="Cassava (flour)" replace kcalper100g = 109 if TXT=="Cassava (root)" replace kcalper100g = 67 if TXT=="Irish Potato" replace kcalper100g = 92 if TXT=="Sweet potato" replace kcalper100g = 86 if TXT=="Tarot/amateke" replace kcalper100g = 567 if TXT=="Ground nuts (peanuts)" replace kcalper100g = 335 if TXT=="Soya (dry)" replace kcalper100g = 22 if TXT=="Amarante (large leafed green)" replace kcalper100g = 22 if TXT=="Amarante (small leafed green)" replace kcalper100g = 19 if TXT=="Cabbages" replace kcalper100g = 38 if TXT=="Carrot" replace kcalper100g = 53 if TXT=="Cassava leaves" replace kcalper100g = 21 if TXT=="Eggplant" replace kcalper100g = 19 if TXT=="Yams/Ibikoro" //"Ibishayote" replace kcalper100g = 12 if TXT=="Lettuce" replace kcalper100g = 24 if TXT=="Onion" replace kcalper100g = 19 if TXT=="Pumpkin" replace kcalper100g = 17 if TXT=="Tomato" *Filling in missing ones replace kcalper100g = 380 if TXT=="Sugar (local)" //same as imported sugar above replace kcalper100g = 48 if TXT=="Banana - beer (Ikakama/Inkashi)" //same as banana juice above replace kcalper100g = 45 if TXT=="Berries" // same as mango above replace kcalper100g = 17 if TXT=="Celery" // same as tomato above replace kcalper100g = 1 if TXT=="Coffee (local)" // same as tea above replace kcalper100g = 17 if TXT=="Cucumber" // same as tomato above replace kcalper100g = 24 if TXT=="Garlic" //same as onion above replace kcalper100g = 17 if TXT=="Guava" // same as mango above replace kcalper100g = 263 if TXT=="Lard of pork" // same as sheep mutton lamb replace kcalper100g = 17 if TXT=="Leeks" // same as tomato above replace kcalper100g = 48 if TXT=="Local Banana beer" // sameas banana juice replace kcalper100g = 173 if TXT=="Local sorghum beer(ikigage)" // same as sorghum juice below replace kcalper100g = 45 if TXT=="Maracouja" // same as mango replace kcalper100g = 343 if TXT=="Millet (flour)" //same as sorghum flour replace kcalper100g = 17 if TXT=="Mushrooms" // same as tomatoes replace kcalper100g = 343 if TXT=="Other flours of cereals," //same as sorghum flour replace kcalper100g = 109 if TXT=="Other tubers" //same as cassava root replace kcalper100g = 17 if TXT=="Parsley" //same as tomato replace kcalper100g = 48 if TXT=="Passion fruit juice" //same as banana juice replace kcalper100g = 864 if TXT=="Peanut oil" //same as palm oil replace kcalper100g = 17 if TXT=="Pepper" //same as tomatoe replace kcalper100g = 24 if TXT=="Pepper-raw" //same as onion replace kcalper100g = 24 if TXT=="Plums" //same as onion replace kcalper100g = 126 if TXT=="Rabbit Meat" //same as other meat replace kcalper100g = 380 if TXT=="Sugar (local)" //same as sugar imported replace kcalper100g = 24 if TXT=="Spinach" //same as onion replace kcalper100g = 380 if TXT=="Sugarcane" //same as sugar above replace kcalper100g = 126 if TXT=="Wild Meat" //same as other meat replace kcalper100g = 109 if TXT=="Yams/Ibikoro" //same as cassava roots replace kcalper100g = 75 if TXT=="Yogurt" //same as curled milk *FROM EICV1 replace kcalper100g = 261 if kcalper100g==. & TXT=="Bread" replace kcalper100g = 30 if kcalper100g==. & TXT=="Carbonated Soft Drin" replace kcalper100g = 30 if kcalper100g==. & TXT=="Citron - Lemon" replace kcalper100g = 49 if kcalper100g==. & TXT=="Fish (fresh / frozen)" replace kcalper100g = 53 if kcalper100g==. & TXT=="Fresh bean" replace kcalper100g = 164 if kcalper100g==. & TXT=="Goat meat" replace kcalper100g = 339 if kcalper100g==. & TXT=="Green pea (dry)" replace kcalper100g = 37 if kcalper100g==. & TXT=="Green pea (fresh)" replace kcalper100g = 387 if kcalper100g==. & TXT=="Groundnut flour" replace kcalper100g = 312 if kcalper100g==. & TXT=="Honey" replace kcalper100g = 363 if kcalper100g==. & TXT=="Imported rice" replace kcalper100g = 36 if kcalper100g==. & TXT=="Maize (fresh)" replace kcalper100g = 500 if kcalper100g==. & TXT=="Milk powder" replace kcalper100g = 24 if kcalper100g==. & TXT=="Other Vegetables" replace kcalper100g = 884 if kcalper100g==. & TXT=="Other plant oils" replace kcalper100g = 884 if kcalper100g==. & TXT=="Palm oil" replace kcalper100g = 240 if kcalper100g==. & TXT=="Pasta" replace kcalper100g = 97 if kcalper100g==. & TXT=="Small Sized Fish" replace kcalper100g = 343 if kcalper100g==. & TXT=="Sorghum" replace kcalper100g = 343 if kcalper100g==. & TXT=="Sorghum (flour)" replace kcalper100g = 173 if kcalper100g==. & TXT=="Sorghum juice(Ubushera)" replace kcalper100g = 405 if kcalper100g==. & TXT=="Soya (fresh)" replace kcalper100g = 405 if kcalper100g==. & TXT=="Soya Flour" replace kcalper100g = 32 if kcalper100g==. & TXT=="String bean" replace kcalper100g = 380 if kcalper100g==. & TXT=="Sugar (imported)" replace kcalper100g = 380 if kcalper100g==. & TXT=="Sugar (local)" replace kcalper100g = 1 if kcalper100g==. & TXT=="Tea (imported)" replace kcalper100g = 1 if kcalper100g==. & TXT=="Tea (local)" replace kcalper100g = 364 if kcalper100g==. & TXT=="Wheat (flour)" replace kcalper100g = 364 if kcalper100g==. & TXT=="Wheat (grain)" replace kcalper100g = . if kcalper100g==. & TXT=="Biscuits" * *Adjusting quantities by the same amount as in 2014 (scaled up/ adjusted scaled up qty in table B4) gen adjfactor = . replace adjfactor = 0.06489753 if TXT == "Corn (flour)" replace adjfactor = 1.626396648 if TXT == "Dry maize (grain)" replace adjfactor = 0.373305527 if TXT == "Local rice" replace adjfactor = 5.082051282 if TXT == "Sorghum" replace adjfactor = 1.466729147 if TXT == "Sorghum(flour)" replace adjfactor = 1.466729147 if TXT == "Sorghum (flour)" replace adjfactor = 1 if TXT == "Eggs" replace adjfactor = 1 if TXT == "Fish (dry / smoked)" replace adjfactor = 3.449123989 if TXT == "Avocado" replace adjfactor = 0.289927349 if TXT == "Banana - cooking (Inyamunyo)" replace adjfactor = 0.494818653 if TXT == "Banana fruit (Imineke)" replace adjfactor = 0.589385475 if TXT == "Local banana juice" replace adjfactor = 3.433333333 if TXT == "Mangos" replace adjfactor = 1 if TXT == "Orange (local)" replace adjfactor = 1 if TXT == "Papayas" replace adjfactor = 1 if TXT == "Pineapple" replace adjfactor = 0.021084337 if TXT == "Beef meat" replace adjfactor = 0.777777778 if TXT == "Chicken live" replace adjfactor = 13.42857143 if TXT == "Other Meats" //| TXT =="Goat meat" | TXT=="Rabbit Meat" | TXT=="Sausages, bacon etc" replace adjfactor = 0.148148148 if TXT == "Pork meat" replace adjfactor = 27 if TXT == "Sheep, mutton or lamb meat" replace adjfactor = 1 if TXT == "Curdled Milk" replace adjfactor = 1 if TXT == "Fresh milk" replace adjfactor = 0.999364191 if TXT == "Dry beans" replace adjfactor = 9.708191126 if TXT == "Cassava (fermented)" replace adjfactor = 0.162185496 if TXT == "Cassava (flour)" replace adjfactor = 1 if TXT == "Cassava (root)" replace adjfactor = 0.192778481 if TXT == "Irish Potato" replace adjfactor = 0.293880837 if TXT == "Sweet potato" replace adjfactor = 2.520694941 if TXT == "Tarot/amateke" replace adjfactor = 1 if TXT == "Ground nuts (peanuts)" replace adjfactor = 1 if TXT == "Soya (dry)" replace adjfactor = 1 if TXT == "Amarante (large leafed green)" replace adjfactor = 1 if TXT == "Amarante (small leafed green)" replace adjfactor = 1 if TXT == "Cabbages" replace adjfactor = 1 if TXT == "Carrot" replace adjfactor = 1 if TXT == "Cassava leaves" replace adjfactor = 1 if TXT == "Eggplant" replace adjfactor = 1 if TXT == "Yams/Ibikoro" //"Ibishayote" replace adjfactor = 1 if TXT == "Lettuce" replace adjfactor = 1 if TXT == "Onion" replace adjfactor = 1 if TXT == "Pumpkin" replace adjfactor = 1 if TXT == "Tomato" *FROM EICV1 replace adjfactor = 1 if adjfactor==. & TXT=="Banana - beer (Ikakama/Inkashi)" replace adjfactor = 1 if adjfactor==. & TXT=="Berries" replace adjfactor = 1 if adjfactor==. & TXT=="Bread" replace adjfactor = 1 if adjfactor==. & TXT=="Carbonated Soft Drin" replace adjfactor = 1 if adjfactor==. & TXT=="Celery" replace adjfactor = 1 if adjfactor==. & TXT=="Citron - Lemon" replace adjfactor = 1 if adjfactor==. & TXT=="Coffee (local)" replace adjfactor = 1 if adjfactor==. & TXT=="Cucumber" replace adjfactor = 1 if adjfactor==. & TXT=="Fish (fresh / frozen)" replace adjfactor = 1 if adjfactor==. & TXT=="Fresh bean" replace adjfactor = 1 if adjfactor==. & TXT=="Garlic" replace adjfactor = 1 if adjfactor==. & TXT=="Goat meat" replace adjfactor = 1 if adjfactor==. & TXT=="Green pea (dry)" replace adjfactor = 1 if adjfactor==. & TXT=="Green pea (fresh)" replace adjfactor = 1 if adjfactor==. & TXT=="Groundnut flour" replace adjfactor = 1 if adjfactor==. & TXT=="Guava" replace adjfactor = 1 if adjfactor==. & TXT=="Honey" replace adjfactor = 1 if adjfactor==. & TXT=="Imported rice" replace adjfactor = 1 if adjfactor==. & TXT=="Lard of pork" replace adjfactor = 1 if adjfactor==. & TXT=="Leeks" replace adjfactor = 1 if adjfactor==. & TXT=="Local Banana beer" replace adjfactor = 1 if adjfactor==. & TXT=="Local sorghum beer(ikigage)" replace adjfactor = 1 if adjfactor==. & TXT=="Maize (fresh)" replace adjfactor = 1 if adjfactor==. & TXT=="Maracouja" replace adjfactor = 1 if adjfactor==. & TXT=="Milk powder" replace adjfactor = 1 if adjfactor==. & TXT=="Millet (flour)" replace adjfactor = 1 if adjfactor==. & TXT=="Mushrooms" replace adjfactor = 1 if adjfactor==. & TXT=="Other flours of cereals," replace adjfactor = 1 if adjfactor==. & TXT=="Other Vegetables" replace adjfactor = 1 if adjfactor==. & TXT=="Other plant oils" replace adjfactor = 1 if adjfactor==. & TXT=="Other tubers" replace adjfactor = 1 if adjfactor==. & TXT=="Palm oil" replace adjfactor = 1 if adjfactor==. & TXT=="Parsley" replace adjfactor = 1 if adjfactor==. & TXT=="Passion fruit juice" replace adjfactor = 1 if adjfactor==. & TXT=="Pasta" replace adjfactor = 1 if adjfactor==. & TXT=="Peanut oil" replace adjfactor = 1 if adjfactor==. & TXT=="Pepper" replace adjfactor = 1 if adjfactor==. & TXT=="Pepper-raw" replace adjfactor = 1 if adjfactor==. & TXT=="Plums" replace adjfactor = 1 if adjfactor==. & TXT=="Rabbit Meat" replace adjfactor = 1 if adjfactor==. & TXT=="Small Sized Fish" replace adjfactor = 1 if adjfactor==. & TXT=="Sorghum" replace adjfactor = 1 if adjfactor==. & TXT=="Sorghum (flour)" replace adjfactor = 1 if adjfactor==. & TXT=="Sorghum juice(Ubushera)" replace adjfactor = 1 if adjfactor==. & TXT=="Soya (fresh)" replace adjfactor = 1 if adjfactor==. & TXT=="Soya Flour" replace adjfactor = 1 if adjfactor==. & TXT=="Spinach" replace adjfactor = 1 if adjfactor==. & TXT=="String bean" replace adjfactor = 1 if adjfactor==. & TXT=="Sugar (imported)" replace adjfactor = 1 if adjfactor==. & TXT=="Sugar (local)" replace adjfactor = 1 if adjfactor==. & TXT=="Sugarcane" replace adjfactor = 1 if adjfactor==. & TXT=="Tea (imported)" replace adjfactor = 1 if adjfactor==. & TXT=="Tea (local)" replace adjfactor = 1 if adjfactor==. & TXT=="Wheat (flour)" replace adjfactor = 1 if adjfactor==. & TXT=="Wheat (grain)" replace adjfactor = 1 if adjfactor==. & TXT=="Wild Meat" replace adjfactor = 1 if adjfactor==. & TXT=="Yams/Ibikoro" replace adjfactor = 1 if adjfactor==. & TXT=="Yogurt" *FROM EIV4: weights of consumption items in basket gen foodqae14 = . replace foodqae14 = 0.01835526 if TXT=="Corn (flour)" replace foodqae14 = 0.013813145 if TXT=="Dry maize (grain)" replace foodqae14 = 0.009247573 if TXT=="Local rice" replace foodqae14 = 0.002818775 if TXT=="Sorghum" replace foodqae14 = 0.005144923 if TXT=="Sorghum (flour)" replace foodqae14 = 0.000935924 if TXT=="Eggs" replace foodqae14 = 0.012727656 if TXT=="Fish (dry / smoked)" replace foodqae14 = 0.014311332 if TXT=="Avocado" replace foodqae14 = 0.07832337 if TXT=="Banana - cooking (Inyamunyo)" replace foodqae14 = 0.005586184 if TXT=="Banana fruit (Imineke)" replace foodqae14 = 0.003451249 if TXT=="Local banana juice" replace foodqae14 = 0.002168461 if TXT=="Mangos" replace foodqae14 = 0.000197944 if TXT=="Orange (local)" replace foodqae14 = 0.001397093 if TXT=="Papayas" replace foodqae14 = 0.001349244 if TXT=="Pineapple" replace foodqae14 = 0.001599325 if TXT=="Beef meat" replace foodqae14 = 0.00004347 if TXT=="Chicken live" replace foodqae14 = 0.0000346 if TXT=="Other meats" //| TXT=="Goat meat" //| TXT=="Rabbit Meat" | TXT=="Sausages, bacon etc" //"Goat meat" | TXT=="Rabbit Meat" | TXT=="Sausages, bacon etc" replace foodqae14 = 0.000260615 if TXT=="Pork meat" replace foodqae14 = 0.00003325 if TXT=="Sheep, mutton or lamb meat" replace foodqae14 = 0.005298077 if TXT=="Curdled Milk" replace foodqae14 = 0.006197359 if TXT=="Fresh milk" replace foodqae14 = 0.075845616 if TXT=="Dry beans" replace foodqae14 = 0.01130231 if TXT=="Cassava (fermented)" replace foodqae14 = 0.039097123 if TXT=="Cassava (flour)" replace foodqae14 = 0.069385616 if TXT=="Cassava (root)" replace foodqae14 = 0.125675342 if TXT=="Irish Potato" replace foodqae14 = 0.311440274 if TXT=="Sweet potato" replace foodqae14 = 0.018874707 if TXT=="Tarot/amateke" replace foodqae14 = 0.00009243 if TXT=="Ground nuts (peanuts)" replace foodqae14 = 0.000381814 if TXT=="Soya (dry)" replace foodqae14 = 0.002812896 if TXT=="Amarante (large leafed green)" replace foodqae14 = 0.015043795 if TXT=="Amarante (small leafed green)" replace foodqae14 = 0.017226932 if TXT=="Cabbages" replace foodqae14 = 0.001053907 if TXT=="Carrot" replace foodqae14 = 0.009334622 if TXT=="Cassava leaves" replace foodqae14 = 0.008161573 if TXT=="Eggplant" replace foodqae14 = 0.01036551 if TXT== "Yams/Ibikoro" //"Ibishayote" replace foodqae14 = 0.000006836 if TXT=="Lettuce" replace foodqae14 = 0.002421793 if TXT=="Onion" replace foodqae14 = 0.005770416 if TXT=="Pumpkin" replace foodqae14 = 0.014554036 if TXT=="Tomato" *FROM EICV1: weights of consumption items in basket gen foodqae01 = . replace foodqae01 = 0.0100 if TXT=="Corn (flour)" replace foodqae01 = 0.0103 if TXT=="Dry maize (grain)" replace foodqae01 = 0.0027 if TXT=="Local rice" replace foodqae01 = 0.0253 if TXT=="Sorghum" replace foodqae01 = 0.0031 if TXT=="Sorghum (flour)" replace foodqae01 = 0.0007 if TXT=="Eggs" replace foodqae01 = 0 if TXT=="Fish (dry / smoked)" replace foodqae01 = 0.0036 if TXT=="Avocado" replace foodqae01 = 0.0573 if TXT=="Banana - cooking (Inyamunyo)" replace foodqae01 = 0.0038 if TXT=="Banana fruit (Imineke)" replace foodqae01 = 0 if TXT=="Local banana juice" replace foodqae01 = 0 if TXT=="Mangos" replace foodqae01 = 0 if TXT=="Orange (local)" replace foodqae01 = 0.0006 if TXT=="Papayas" replace foodqae01 = 0.0002 if TXT=="Pineapple" replace foodqae01 = 0.0006 if TXT=="Beef meat" replace foodqae01 = 0 if TXT=="Chicken live" replace foodqae01 = 0 if TXT=="Other meats" //| TXT=="Goat meat" //| TXT=="Rabbit Meat" | TXT=="Sausages, bacon etc" //"Goat meat" | TXT=="Rabbit Meat" | TXT=="Sausages, bacon etc" replace foodqae01 = 0 if TXT=="Pork meat" replace foodqae01 = 0 if TXT=="Sheep, mutton or lamb meat" replace foodqae01 = 0.0007 if TXT=="Curdled Milk" replace foodqae01 = 0.0010 if TXT=="Fresh milk" replace foodqae01 = 0.1130 if TXT=="Dry beans" replace foodqae01 = 0.0056 if TXT=="Cassava (fermented)" //manioc seche replace foodqae01 = 0.0134 if TXT=="Cassava (flour)" replace foodqae01 = 0.0410 if TXT=="Cassava (root)" replace foodqae01 = 0.1763 if TXT=="Irish Potato" replace foodqae01 = 0.4033 if TXT=="Sweet potato" replace foodqae01 = 0.0098 if TXT=="Tarot/amateke" replace foodqae01 = 0.0009 if TXT=="Ground nuts (peanuts)" replace foodqae01 = 0 if TXT=="Soya (dry)" replace foodqae01 = 0.0039 if TXT=="Amarante (large leafed green)" //Imbwija replace foodqae01 = 0.0124 if TXT=="Amarante (small leafed green)" replace foodqae01 = 0.0207 if TXT=="Cabbages" replace foodqae01 = 0.0003 if TXT=="Carrot" replace foodqae01 = 0.0068 if TXT=="Cassava leaves" replace foodqae01 = 0.0070 if TXT=="Eggplant" replace foodqae01 = 0 if TXT== "Yams/Ibikoro" //"" replace foodqae01 = 0.0000 if TXT=="Lettuce" replace foodqae01 = 0.0017 if TXT=="Onion" replace foodqae01 = 0.0068 if TXT=="Pumpkin" //Courge replace foodqae01 = 0.0106 if TXT=="Tomato" replace foodqae01 = 0.0150 if TXT=="Local sorghum beer(ikigage)" //from EICV1 replace foodqae01 = 0.0001 if TXT=="Biscuits" //from EICV1 replace foodqae01 = 0.0096 if TXT=="Local Banana beer" replace foodqae01 = 0.0068 if TXT=="String bean" replace foodqae01 = 0 if TXT=="Cucumber" // replace foodqae01 = 0.0065 if TXT=="Maize (fresh)" *replace foodqae01 = 0 if TXT=="Soya Flour" replace foodqae01 = 0.0036 if TXT=="Palm oil" replace foodqae01 = 0.0031 if TXT=="Other Vegetables" replace foodqae01 = 0.0002 if TXT=="Guava" // replace foodqae01 = 0.0002 if TXT=="Maracouja" // replace foodqae01 = 0.0001 if TXT=="Plums" //prune replace foodqae01 = 0.0027 if TXT=="Sugar (local)" replace foodqae01 = 0.0023 if TXT=="Soya (fresh)" replace foodqae01 = 0.0014 if TXT=="Imported rice" replace foodqae01 = 0.0002 if TXT=="Pepper" replace foodqae01 = 0.0011 if TXT=="Bread" replace foodqae01 = 0.0010 if TXT=="Green pea (dry)" replace foodqae01 = 0.0007 if TXT=="Fretein" // doesnt exist replace foodqae01 = 0.0006 if TXT=="Other leaves" //doesn't exist replace foodqae01 = 0.0006 if TXT=="Green pea (fresh)" replace foodqae01 = 0.0005 if TXT=="Fish (fresh / frozen)" replace foodqae01 = 0.0004 if TXT=="Groundnut flour" replace foodqae01 = 0.0004 if TXT=="Carbonated Soft Drin" replace foodqae01 = 0.0002 if TXT=="Fresh bean" replace foodqae01 = 0.0002 if TXT=="Goat meat" //| TXT=="Rabbit Meat" | TXT=="Sausages, bacon etc" //"Goat meat" | TXT=="Rabbit Meat" | TXT=="Sausages, bacon etc" replace foodqae01 = 0.0001 if TXT=="Tomato cocentrate" //does not exist replace foodqae01 = 0.0001 if TXT=="Wheat (flour)" replace foodqae01 = 0.0001 if TXT=="Citron - Lemon" replace foodqae01 = 0.000049 if TXT=="Honey" replace foodqae01 = 0.000084 if TXT=="Other plant oils" //huile de mais + autres + soja replace foodqae01 = 0.0052 if TXT=="Salt" //not found replace foodqae01 = 0.000022 if TXT=="Margarine" // replace foodqae01 = 0.000045 if TXT=="Tea (local)" replace foodqae01 = 0.000008 if TXT=="Jam, marmelade" //d replace foodqae01 = 0.0009 if TXT=="Candy / Gum" // replace foodqae01 = 0.000001 if TXT=="Condensed milk" //not found replace foodqae01 = 0.000003 if TXT=="Condensed milk unsweetened" // replace foodqae01 = 0.000016 if TXT=="Milk powder" replace foodqae01 = 0.000015 if TXT=="Pasta" replace foodqae01 = 0.000026 if TXT=="Wine (local)" // replace foodqae01 = 0.000036 if TXT=="Passion fruit juice" replace foodqae01 = 0.000021 if TXT=="Pepper-raw" *Missing prices (original 2001 prices updated for inflatio) replace S9DQ15 = . if S9DQ15==. & TXT=="Biscuits" //from EICV1 replace S9DQ15 = 363*1.46 if S9DQ15==. & TXT=="Palm oil" replace S9DQ15 = 272*1.46 if S9DQ15==. & TXT=="Sugar (local)" replace S9DQ15 = 250*1.46 if S9DQ15==. & TXT=="Imported rice" replace S9DQ15 = . if S9DQ15==. & TXT=="Pepper" replace S9DQ15 = 130*1.46 if S9DQ15==. & TXT=="Bread" replace S9DQ15 = 321*1.46 if S9DQ15==. & TXT=="Groundnut flour" replace S9DQ15 = 104*1.46 if S9DQ15==. & TXT=="Carbonated Soft Drin" replace S9DQ15 = 75*1.46 if S9DQ15==. & TXT=="Tomato concentrate" //does not exist replace S9DQ15 = 616*1.46 if S9DQ15==. & TXT=="Honey" replace S9DQ15 = . if S9DQ15==. & TXT=="Other plant oils" //huile de mais + autres + soja replace S9DQ15 = . if S9DQ15==. & TXT=="Salt" //not found replace S9DQ15 = . if S9DQ15==. & TXT=="Margarine" // replace S9DQ15 = 715*1.46 if S9DQ15==. & TXT=="Tea (local)" replace S9DQ15 = . if S9DQ15==. & TXT=="Jam, marmelade" //d replace S9DQ15 = . if S9DQ15==. & TXT=="Candy / Gum" // replace S9DQ15 = . if S9DQ15==. & TXT=="Condensed milk" //not found replace S9DQ15 = . if S9DQ15==. & TXT=="Condensed milk unsweetened" // replace S9DQ15 = 1424*1.46 if S9DQ15==. & TXT=="Milk powder" replace S9DQ15 = . if S9DQ15==. & TXT=="Pasta" replace S9DQ15 = . if S9DQ15==. & TXT=="Wine (local)" // replace S9DQ15 = . if S9DQ15==. & TXT=="Passion fruit juice" replace S9DQ15 = . if S9DQ15==. & TXT=="Salt" replace foodqae14 =. if S9DQ15==. replace foodqae01 =. if S9DQ15==. replace foodqae =. if S9DQ15==. *Poverty lines gen adjfoodqae = foodqae * adjfactor gen adjfood2014= foodqae14 * adjfactor gen actfood2014= foodqae14 gen actfood2001= foodqae01 gen adjkcalconsumed = kcalper100g * adjfoodqae * 10 gen actkcalconsumed = kcalper100g * foodqae * 10 gen adjkcalcons2014 = kcalper100g * adjfood2014 * 10 gen actkcalcons2014 = kcalper100g * actfood2014 * 10 gen actkcalcons2001 = kcalper100g * actfood2001 * 10 egen adjtotkcalae = total(adjkcalconsumed) egen acttotkcalae = total(actkcalconsumed) egen adjtotkcal14 = total(adjkcalcons2014) egen acttotkcal14 = total(actkcalcons2014) egen acttotkcal01 = total(actkcalcons2001) gen adjscaleupfactor = 2500/ adjtotkcalae gen actscaleupfactor = 2500/ acttotkcalae gen adjscaleupfa2014 = 2500/ adjtotkcal14 gen actscaleupfa2014 = 2500/ acttotkcal14 gen actscaleupfa2001 = 2500/ acttotkcal01 gen actscaledkg = foodqae * actscaleupfactor gen adjscaledkg = adjfoodqae * adjscaleupfactor // gen adjscaled14 = adjfood2014 * adjscaleupfa2014 gen actscaled14 = foodqae14 * actscaleupfa2014 gen actscaled01 = foodqae01 * actscaleupfa2001 gen adjrwfperae = adjscaledkg * S9DQ15 // gen actrwfperae = actscaledkg * S9DQ15 if adjrwfperae!=. // gen adjrwfperae14= adjscaled14 * S9DQ15 if adjrwfperae!=. // gen actrwfperae14= actscaled14 * S9DQ15 if adjrwfperae!=. // gen actrwfperae01= actscaled01 * S9DQ15 if adjrwfperae!=. // egen adjfoodbsk = total (adjrwfperae) egen actfoodbsk = total (actrwfperae) egen adjfoodbsk14= total (adjrwfperae14) egen actfoodbsk14= total (actrwfperae14) egen actfoodbsk01= total (actrwfperae01) local adjpovline = (365*adjfoodbsk) / foodshr local actpovline = (365*actfoodbsk) / foodshr local adjpovline14 = (365*adjfoodbsk14) / .6523 local actpovline14 = (365*actfoodbsk14) / .6523 local actpovline01 = (365*actfoodbsk01) / .69 local adjfoodline= 365*adjfoodbsk local actfoodline= 365*actfoodbsk local adjfoodline14= 365*adjfoodbsk14 local actfoodline14= 365*actfoodbsk14 local actfoodline01= 365*actfoodbsk01 save povlines05, replace restore *Poverty headcount gen adjpovline = `adjpovline' gen actpovline = `actpovline' gen adjpovline14 = `adjpovline14' gen actpovline14 = `actpovline14' gen actpovline01 = `actpovline01' gen adjfoodline= `adjfoodline' gen actfoodline= `actfoodline' gen adjfoodline14= `adjfoodline14' gen actfoodline14= `actfoodline14' gen actfoodline01= `actfoodline01' replace prcadtot = prcadtot //- 4000 // this is to get official estimate gen actfoodpoor =(prcadtot