* do e:\DHS\India\NFHS4_table_8pt20_do_KR_27Mar2023.txt /* Program to replicate Table 8.20 in the NFHS-4 report (using IAKR74) Similar to a program for Table 8.20 in the NFHS-5 report (using IAKR7D) Both programs match the n's and are close for the means but do not match the means. The average out-of-pocket cost paid for delivery for the most recent live birth among women age 15-49 who had a live birth in the 5 years preceding the survey that was delivered in a health facility. Out-of-pocket cost paid for the delivery includes the cost of transportation, the hospital stay, tests, medicines, and other costs. In IAKR74 the components are these five variables: s451 and s452a, b, c, d. Total is s449. In IAKR7D the components are these five variables: s448aa, ba, bb, bc, bd. Total is s454. This program works off the KR file rather than the IR file. Select one child per woman and then the analysis is equivalent to using women as units. Rule 1: Calculate the total as the sum of the 5 components if they are all <99998 Rule 2: If any of the components are 99998, and s449 is NOT 99998, use s449 as the total Rule 3: If all the components are 99998 and s449 is 99998, ignore the case Numbers in the table to match, bottom row public 3,197 Rs private 16,522 Rs any 7,935 Rs cases 149,768 Row for Jain (v130==6, only 234 weighted cases), can use for testing public 2,682 Rs private 18,789 Rs any 13,812 Rs */ ************************************************************************* program define make_data use "C:\Users\26216\ICF\Analysis - Shared Resources\Data\DHSdata\IAKR74FL.DTA", clear * Save the variables needed keep v0* v130 v201 b* m15* s116 s448* s449 gen mo_age=1 replace mo_age=2 if b3-v011>=20*12 replace mo_age=3 if b3-v011>=35*12 label variable mo_age "Mother's age at birth" label define mo_age 1 "<20" 2 "20-34" 3 "35+" label values mo_age mo_age *tab mo_age * Birth order * To match birth order in the tables, bord must be modified to include multiple births gen border=. forvalues ll=1/5 { replace border=`ll' if (bord==`ll' & b0==0) | (bord==`ll'+1 & b0==2) | (bord==`ll'+2 & b0==3) } gen birth_order=1 if border==1 replace birth_order=2 if border>1 replace birth_order=3 if border>3 label variable birth_order "Birth order" label define birth_order 1 "1" 2 "2-3" 3 "4+" label values birth_order birth_order *tab birth_order gen religion=v130 replace religion=7 if v130>=7 label variable religion "Religion" label define religion 1 "Hindu" 2 "Muslim" 3 "Christian" 4 "Sikh" 5 "Buddhist/Neo-Buddhist" 6 "Jain" 7 "Other" label values religion religion *tab religion gen caste=s116 replace caste=4 if caste==. label variable caste "Caste/tribe" label define caste 1 "Scheduled caste" 2 "Scheduled tribe" 3 "Other backward class" 4 "Other" 8 "Don't know" label values caste caste *tab caste * Construct recodes for facility type and cost for the births in the past 5 years gen factype=1 replace factype=2 if m15>=20 replace factype=3 if m15>=30 replace factype=9 if m15>=40 replace factype=. if m15==. label define factype 1 "Home" 2 "Public" 3 "Private" 9 "Other" label values factype factype gen factype2or3=0 replace factype2or3=1 if factype==2 | factype==3 * Change the five components to more convenient variable names gen cost1=s448aa gen cost2=s448ba gen cost3=s448bb gen cost4=s448bc gen cost5=s448bd tab factype bidx [iweight=v005/1000000],m * Find the most recent birth with factype2or3 equal to 1 * Reduce to births with factype2or3=1 keep if factype2or3==1 * To match the n's in the table, select if bidx=1 * This is not necessarily following the title of the table. However, it matches the n's. keep if bidx==1 save IAtemp.dta, replace end ************************************************************************* program define make_frequencies * This routine gives the n's use IAtemp.dta, clear tab1 factype mo_age birth_order v025 religion caste [iweight=v005/1000000] * I have not included the education covariate end ************************************************************************* program define make_table use IAtemp.dta, clear * calculate the sum of the components gen total=0 forvalues lc=1/5 { replace total=total+cost`lc' if cost`lc'<99998 } replace total=99998 if cost1==99998 | cost2==99998 | cost3==99998 | cost4==99998 | cost5==99998 * Rule: use s454 as a default if it is coded with a valid value * Otherwise use the sum of the components IF no components are 99998 gen cost=s449 if factype2or3==1 replace cost=total if factype2or3==1 & (s449==. | s449==99998) & (total ~=. & total~=99998) ********************************* * Optional: find and correct typos that should be 99998 *tab cost * Possible examples: *replace cost=99998 if cost==99990 *replace cost=99998 if cost==99988 *replace cost=99998 if cost==99995 ********************************* * Drop if cost=99998 replace cost=. if cost==99998 gen pub_cost=. replace pub_cost=cost if factype==2 gen priv_cost=. replace priv_cost=cost if factype==3 gen pubpriv_cost=. replace pubpriv_cost=cost if factype2or3==1 local lcovars mo_age birth_order v025 religion caste foreach lc of local lcovars { tabstat *_cost [fweight=v005], statistics(mean) by(`lc') } * Can save the data file end ************************************************************************* ************************************************************************* ************************************************************************* ************************************************************************* ************************************************************************* * Execution begins here * Specify a workspace cd e:\DHS\DHS_data\scratch * Do not need to rerun "make_data" after the data file has been constructed make_data make_frequencies make_table