Skip to content

Commit 02c4aa3

Browse files
committed
Finishing the update to SSP definition and farm productivity sold
* Fixed error where farm productivity was missing if any of the subcomponents (crops, livestock, livestock products) were missing * Changed ssp definition to only apply to agricultural households.
1 parent 031d73c commit 02c4aa3

File tree

22 files changed

+408
-452
lines changed

22 files changed

+408
-452
lines changed

Ethiopia ESS/Ethiopia ESS Wave 1/EPAR_UW_Ethiopia_ESS_W1.do

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
55
*Author(s) : Didier Alia & C. Leigh Anderson; uw.eparx@uw.edu
66
7-
*Date : March 31st, 2025
7+
*Date : September 5th, 2025
88
*Dataset version: ETH_2011_ERSS_v02_M_Stata8
99
----------------------------------------------------------------------------------------------------------------------------------------------------*/
1010

@@ -1210,9 +1210,9 @@ gen ha_harvest= ha_planted*pct_harvest
12101210

12111211
gen qty_harv_kg = ph_s9q12_a //kilos
12121212
gen qty_harv_g = ph_s9q12_a/1000 //grams
1213-
egen qty_harv= rowtotal(qty_harv_kg qty_harv_g)
1214-
replace qty_harv=. if qty_harv_kg==. & qty_harv_g==.
1215-
replace quant_harv_kg = qty_harv if quant_harv_kg==.
1213+
egen kg_harvest= rowtotal(qty_harv_kg qty_harv_g)
1214+
replace kg_harvest=. if qty_harv_kg==. & qty_harv_g==.
1215+
//replace quant_harv_kg = qty_harv if quant_harv_kg==.
12161216

12171217
* Merge in price per unit and price per kg - generated from S11
12181218
foreach i in region zone woreda kebele ea hhid {
@@ -1231,15 +1231,15 @@ gen ha_harvest= ha_planted*pct_harvest
12311231

12321232

12331233
* VALUE HARVEST
1234-
gen value_harvest = quant_harv_kg*price_kg
1234+
gen value_harvest = kg_harvest*price_kg
12351235

12361236

12371237

12381238
*AgQuery
12391239
bys hhid holder_id parcel_id plot_id : egen area_plan = sum(ha_planted)
12401240
gen percent_inputs = ha_planted / area_plan
12411241
drop if parcel_id == ""
1242-
keep region zone woreda kebele ea hhid holder_id parcel_id plot_id purestand /*crops_plot*/ crop_code val* quant* cultivated ha_planted ha_harvest number_trees_planted percent_inputs months_grown /*reason_loss*/ field_size /*gps_meas*/ lost*
1242+
keep region zone woreda kebele ea hhid holder_id parcel_id plot_id purestand /*crops_plot*/ crop_code val* kg_harvest cultivated ha_planted ha_harvest number_trees_planted percent_inputs months_grown /*reason_loss*/ field_size /*gps_meas*/ lost*
12431243
merge m:1 hhid holder_id parcel_id plot_id using "${Ethiopia_ESS_W1_created_data}/Ethiopia_ESS_W1_plot_decision_makers.dta", nogen keep(1 3) keepusing(dm*) // 105 not matched
12441244

12451245
order region zone woreda kebele ea hhid holder_id parcel_id plot_id crop_code
@@ -2065,7 +2065,7 @@ use "${Ethiopia_ESS_W1_created_data}/Ethiopia_ESS_W1_all_plots.dta", clear
20652065
keep if purestand==1
20662066
merge 1:1 hhid parcel_id plot_id using "${Ethiopia_ESS_W1_created_data}/Ethiopia_ESS_W1_plot_decision_makers.dta", nogen keep(1 3) keepusing(dm_gender)
20672067
ren ha_planted monocrop_ha
2068-
ren quant_harv_kg kgs_harv_mono
2068+
ren kg_harvest kgs_harv_mono
20692069
ren value_harvest val_harv_mono
20702070

20712071
forvalues k=1(1)$nb_topcrops {
@@ -3864,7 +3864,7 @@ save "${Ethiopia_ESS_W1_created_data}/Ethiopia_ESS_W1_trees.dta", replace
38643864
use "${Ethiopia_ESS_W1_created_data}/Ethiopia_ESS_W1_all_plots.dta", clear
38653865
//Legacy stuff- agquery gets handled above.
38663866
gen no_harvest=ha_harvest==.
3867-
ren quant_harv_kg harvest
3867+
ren kg_harvest harvest
38683868
ren ha_planted area_plan
38693869
ren ha_harvest area_harv
38703870
gen mixed = "inter" //Note to adjust this for lost crops
@@ -5123,10 +5123,10 @@ global empty_vars $empty_vars lost_disease*
51235123
merge 1:1 hhid using "${Ethiopia_ESS_W1_created_data}/Ethiopia_ESS_W1_shannon_diversity_index.dta", nogen keep(1 3)
51245124

51255125
*Farm Production (NGA)
5126-
recode value_crop_production value_livestock_products value_slaughtered value_lvstck_sold (.=0)
5127-
gen value_farm_production = value_crop_production + value_livestock_products + value_slaughtered + value_lvstck_sold
5126+
// recode value_crop_production value_livestock_products value_slaughtered value_lvstck_sold (.=0)
5127+
egen value_farm_production = rowtotal(value_crop_production value_livestock_products value_slaughtered value_lvstck_sold)
51285128
lab var value_farm_production "Total value of farm production (crops + livestock products)"
5129-
gen value_farm_prod_sold = value_crop_sales + sales_livestock_products + value_livestock_sales
5129+
egen value_farm_prod_sold = rowtotal(value_crop_sales sales_livestock_products value_livestock_sales)
51305130
lab var value_farm_prod_sold "Total value of farm production that is sold"
51315131
replace value_farm_prod_sold = 0 if value_farm_prod_sold==. & value_farm_production!=.
51325132

@@ -5782,13 +5782,13 @@ replace bottom_40_peraeq = 1 if r(r1) > w_daily_peraeq_cons & rural==1
57825782

57835783
****Currency Conversion Factors*** (ETH)
57845784
gen ccf_loc = 1 / $Ethiopia_ESS_W1_inflation
5785-
lab var ccf_loc "currency conversion factor - 2017 $ETB"
5785+
lab var ccf_loc "currency conversion factor - 2021 $ETB"
57865786
gen ccf_usd = ccf_loc / $Ethiopia_ESS_W1_exchange_rate
5787-
lab var ccf_usd "currency conversion factor - 2017 $USD"
5787+
lab var ccf_usd "currency conversion factor - 2021 $USD"
57885788
gen ccf_1ppp = ccf_loc / $Ethiopia_ESS_W1_cons_ppp_dollar
5789-
lab var ccf_1ppp "currency conversion factor - 2017 $Private Consumption PPP"
5789+
lab var ccf_1ppp "currency conversion factor - 2021 $Private Consumption PPP"
57905790
gen ccf_2ppp = ccf_loc / $Ethiopia_ESS_W1_gdp_ppp_dollar
5791-
lab var ccf_2ppp "currency conversion factor - 2017 $GDP PPP"
5791+
lab var ccf_2ppp "currency conversion factor - 2021 $GDP PPP"
57925792

57935793
gen poverty_under_190 = (daily_percap_cons < $Ethiopia_ESS_W1_poverty_190)
57945794
la var poverty_under_190 "Household per-capita consumption is below $1.90 in 2011 $ PPP"
@@ -5819,7 +5819,7 @@ keep hhid fhh clusterid strataid *weight* *wgt* region zone woreda town subcity
58195819
*/ ccf_loc ccf_usd ccf_1ppp ccf_2ppp *sales_livestock_products nb_cows_today lvstck_holding_srum nb_smallrum_today nb_chickens_today *value_pro* *value_sal* /*
58205820
*/ /*DYA 10.6.2020*/ *value_livestock_sales* *w_value_farm_production* *value_slaughtered* *value_lvstck_sold* *value_crop_sales* *sales_livestock_products* *value_livestock_sales* animals_lost12months /*MGM 8.29.2024: adding in additional indicators for ATA estimates*/ hh_work_age hh_women hh_adult_women tlu_today use_* crop_rotation *rate* *ha_* fcs* rcsi*
58215821

5822-
gen ssp = (farm_size_agland <= 2 & farm_size_agland != 0) & (nb_cows_today <= 10 & nb_smallrum_today <= 10 & nb_chickens_today <= 50) // This line is for HH vars only; rest for all three
5822+
gen ssp = (farm_size_agland <= 2 & farm_size_agland != 0) & (nb_cows_today <= 10 & nb_smallrum_today <= 10 & nb_chickens_today <= 50) if ag_hh==1 // This line is for HH vars only; rest for all three
58235823
ren weight weight_sample
58245824
ren weight_pop_rururb weight
58255825
la var weight_sample "Original survey weight"

Ethiopia ESS/Ethiopia ESS Wave 2/EPAR_UW_Ethiopia_ESS_W2.do

Lines changed: 17 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@
44
55
*Author(s) : Didier Alia & C. Leigh Anderson; uw.eparx@uw.edu
66
7-
All coding errors remain ours alone.
8-
*Date : March 31st, 2025
7+
*Date : September 5th, 2025
98
*Dataset Version: ETH_2013_ESS_v02_M_Stata8
109
----------------------------------------------------------------------------------------------------------------------------------------------------*/
1110

@@ -31,7 +30,7 @@
3130
*The processed files include all households, individuals, and plots in the sample.
3231
*Toward the end of the do.file, a block of code estimates summary statistics (mean, standard error of the mean, minimum, first quartile, median, third quartile, maximum)
3332
*of final indicators, restricted to the rural households only, disaggregated by gender of head of household or plot manager.
34-
*The results are outputted in the excel file "Ethiopia_ESS_W2_summary_stats.rtf" in the "Final DTA files" folder.
33+
*The results are outputted in the excel file "Ethiopia_ESS_W2_summary_stats.xls" in the "Final DTA files" folder.
3534
*It is possible to modify the condition "if rural==1" in the portion of code following the heading "SUMMARY STATISTICS" to generate all summary statistics for a different sub_population.
3635

3736
*The following refer to running this Master do.file with EPAR's cleaned data files. Information on EPAR's cleaning and construction decisions is available in the documents
@@ -1233,21 +1232,21 @@ ren price_unit_hhid price_unit_hh
12331232
replace price_kg_hh=price_kg if price_kg==.
12341233

12351234
* VALUE HARVEST
1236-
gen quant_harv_kg = qty_harv if unit == 1
1237-
replace quant_harv_kg = qty_harv * conversion if unit > 1
1235+
gen kg_harvest = qty_harv if unit == 1
1236+
replace kg_harvest = qty_harv * conversion if unit > 1
12381237
gen value_harvest = qty_harv*price_unit if unit>1
1239-
replace value_harvest = quant_harv_kg*price_kg if value_harvest==.
1238+
replace value_harvest = kg_harvest*price_kg if value_harvest==.
12401239

12411240
gen value_harvest_hh=qty_harv*price_unit_hh
1242-
replace value_harvest_hh=quant_harv_kg * price_kg_hh if value_harvest_hh==.
1241+
replace value_harvest_hh=kg_harvest * price_kg_hh if value_harvest_hh==.
12431242
replace value_harvest_hh=value_harvest if value_harvest_hh==.
12441243
replace value_harvest=value_harvest_hh if value_harvest==.
12451244

12461245
*AgQuery
12471246
bys hhid holder_id parcel_id field_id : egen area_plan= sum(ha_planted)
12481247
gen percent_inputs = ha_planted / area_plan
12491248
drop if parcel_id == ""
1250-
keep region zone woreda kebele ea hhid holder_id parcel_id field_id purestand /*crops_plot*/ crop_code val* quant* cultivated ha_planted ha_harvest number_trees_planted percent_inputs months_grown /*reason_loss*/ field_size /*gps_meas*/ lost* use*
1249+
keep region zone woreda kebele ea hhid holder_id parcel_id field_id purestand /*crops_plot*/ crop_code val* kg_harvest cultivated ha_planted ha_harvest number_trees_planted percent_inputs months_grown /*reason_loss*/ field_size /*gps_meas*/ lost* use*
12511250

12521251
merge m:1 hhid holder_id parcel_id field_id using "${Ethiopia_ESS_W2_created_data}/Ethiopia_ESS_W2_field_decision_makers.dta", nogen keep(1 3) keepusing(dm*) // 105 not matched
12531252
order region zone woreda kebele ea hhid holder_id parcel_id field_id crop_code
@@ -2078,7 +2077,7 @@ use "${Ethiopia_ESS_W2_created_data}/Ethiopia_ESS_W2_all_fields.dta", clear
20782077
drop dup
20792078
merge 1:1 hhid holder_id parcel_id field_id using "${Ethiopia_ESS_W2_created_data}/Ethiopia_ESS_W2_field_decision_makers.dta", nogen keep(1 3) keepusing(dm_gender)
20802079
ren ha_planted monocrop_ha
2081-
ren quant_harv_kg kgs_harv_mono
2080+
ren kg_harvest kgs_harv_mono
20822081
ren value_harvest val_harv_mono
20832082

20842083

@@ -4557,7 +4556,7 @@ save "${Ethiopia_ESS_W2_created_data}/Ethiopia_ESS_W2_trees.dta", replace
45574556
use "${Ethiopia_ESS_W2_created_data}/Ethiopia_ESS_W2_all_fields.dta", clear
45584557
//Legacy stuff- agquery gets handled above.
45594558
gen no_harvest=ha_harvest==.
4560-
ren quant_harv_kg harvest
4559+
ren kg_harvest harvest
45614560
ren ha_planted area_plan
45624561
ren ha_harvest area_harv
45634562
gen mixed = "inter" //Note to adjust this for lost crops
@@ -5413,10 +5412,10 @@ global empty_vars $empty_vars feed_grazing* water_source_nat* water_source_const
54135412
merge 1:1 hhid using "${Ethiopia_ESS_W2_created_data}/Ethiopia_ESS_W2_shannon_diversity_index.dta", nogen keep(1 3)
54145413

54155414
*Farm Production
5416-
recode value_crop_production value_livestock_products value_slaughtered value_lvstck_sold (.=0)
5417-
gen value_farm_production = value_crop_production + value_livestock_products + value_slaughtered + value_lvstck_sold
5415+
// recode value_crop_production value_livestock_products value_slaughtered value_lvstck_sold (.=0)
5416+
egen value_farm_production = rowtotal(value_crop_production value_livestock_products value_slaughtered value_lvstck_sold)
54185417
lab var value_farm_production "Total value of farm production (crops + livestock products)"
5419-
gen value_farm_prod_sold = value_crop_sales + sales_livestock_products + value_livestock_sales
5418+
egen value_farm_prod_sold = rowtotal(value_crop_sales sales_livestock_products value_livestock_sales)
54205419
lab var value_farm_prod_sold "Total value of farm production that is sold"
54215420
replace value_farm_prod_sold = 0 if value_farm_prod_sold==. & value_farm_production!=.
54225421

@@ -6058,13 +6057,13 @@ replace bottom_40_peraeq = 1 if r(r1) > w_daily_peraeq_cons & rural==1
60586057

60596058
****Currency Conversion Factors*** (ETH)
60606059
gen ccf_loc = 1 / $Ethiopia_ESS_W2_inflation
6061-
lab var ccf_loc "currency conversion factor - 2017 $ETB"
6060+
lab var ccf_loc "currency conversion factor - 2021 $ETB"
60626061
gen ccf_usd = ccf_loc / $Ethiopia_ESS_W2_exchange_rate
6063-
lab var ccf_usd "currency conversion factor - 2017 $USD"
6062+
lab var ccf_usd "currency conversion factor - 2021 $USD"
60646063
gen ccf_1ppp = ccf_loc / $Ethiopia_ESS_W2_cons_ppp_dollar
6065-
lab var ccf_1ppp "currency conversion factor - 2017 $Private Consumption PPP"
6064+
lab var ccf_1ppp "currency conversion factor - 2021 $Private Consumption PPP"
60666065
gen ccf_2ppp = ccf_loc / $Ethiopia_ESS_W2_gdp_ppp_dollar
6067-
lab var ccf_2ppp "currency conversion factor - 2017 $GDP PPP"
6066+
lab var ccf_2ppp "currency conversion factor - 2021 $GDP PPP"
60686067

60696068
gen poverty_under_190 = (daily_percap_cons < $Ethiopia_ESS_W2_poverty_190)
60706069
la var poverty_under_19 "Household per-capita consumption is below $1.90 in 2011 $ PPP"
@@ -6082,7 +6081,7 @@ drop harvest_* w_harvest_*
60826081
*Removing intermediate variables to get below 5,000 vars (ETH)
60836082
keep hhid fhh clusterid strataid *weight* *wgt* region zone woreda /*city subcity*/ kebele ea /*household*/ rural farm_size* *total_income* *percapita_income* *percapita_cons* *daily_percap_cons* *peraeq_cons* *daily_peraeq_cons* *income* *share* *proportion_cropvalue_sold *farm_size_agland hh_members adulteq *labor_family *labor_hired use_inorg_fert vac_* feed* water* lvstck_housed* ext_* use_fin_* lvstck_holding* *mortality_rate* *lost_disease* disease* any_imp* /*formal_land_rights_hh ALT:MISSING*/ *livestock_expenses* *ls_exp_vac* *prop_farm_prod_sold *hrs_* /*months_food_insec*/ *value_assets* hhs_* *dist_agrodealer encs* num_crops_* multiple_crops* imprv_seed_* hybrid_seed_* *labor_total *farm_area *labor_productivity* *land_productivity* *wage_paid_aglabor* *labor_hired ar_h_wgt_* *yield_hv_* ar_pl_wgt_* *yield_pl_* *liters_per_* milk_animals poultry_owned *costs_dairy* *cost_per_lit* *egg_poultry_year* *ha_planted* *cost_expli_hh* *cost_expli_ha* /* *monocrop_ha* */ *kgs_harv_mono* *cost_total_ha* *_exp* poverty* *value_crop_production* *value_harv* *value_crop_sales* *value_sold* *kgs_harvest* *total_planted_area* *total_harv_area* *all_area_* grew_* agactivities_hh ag_hh crop_hh livestock_hh fishing_hh *_milk_produced* *eggs_total_year *value_eggs_produced* *value_livestock_products* *value_livestock_sales* *total_cons* nb_largerum_today nb_cattle_today nb_poultry_today bottom_40_percap bottom_40_peraeq ccf_loc ccf_usd ccf_1ppp ccf_2ppp *sales_livestock_products nb_cows_today lvstck_holding_srum nb_smallrum_today nb_chickens_today *value_pro* *value_sal* *value_livestock_sales* *w_value_farm_production* *value_slaughtered* *value_lvstck_sold* *value_crop_sales* *sales_livestock_products* *value_livestock_sales* animals_lost12months *area_plan* *_inter_* /*MGM 8.29.2024: adding in additional indicators for ATA estimates*/ hh_work_age hh_women hh_adult_women tlu_today use_* crop_rotation *rate*
60846083

6085-
gen ssp = (farm_size_agland <= 2 & farm_size_agland != 0) & (nb_cows_today <= 10 & nb_smallrum_today <= 10 & nb_chickens_today <= 50) // This line is for HH vars only; rest for all three
6084+
gen ssp = (farm_size_agland <= 2 & farm_size_agland != 0) & (nb_cows_today <= 10 & nb_smallrum_today <= 10 & nb_chickens_today <= 50) if ag_hh==1 // This line is for HH vars only; rest for all three
60866085
ren weight weight_sample
60876086
ren weight_pop_rururb weight
60886087
la var weight_sample "Original survey weight"

0 commit comments

Comments
 (0)