* do e:\DHS\India\table_8pt20_do_KR_12Jan2023.txt /* Program to replicate Table 8.20 in the NFHS-5 report 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. The components are these five variables: s451 and s452a, b, c, d. 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 s454 is NOT 99998, use s454 as the total Rule 3: If all the components are 99998 and s454 is 99998, ignore the case Numbers in the table to match, bottom row public 3,245 Rs private 24,663 Rs any 10,035 Rs cases 157,552 Row for Jain (v130==6, only 272 weighted cases), can use for testing public 7,601 Rs private 32,133 Rs any 26,955 Rs */ ************************************************************************* program define make_data use "C:\Users\26216\ICF\Analysis - Shared Resources\Data\DHSdata\IAKR7DFL.DTA", clear * Save the variables needed keep v0* v130 v201 b* m15* s116 s45* 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 gen birth_order=bord replace birth_order=2 if bord>=2 replace birth_order=3 if bord>=4 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=s451 gen cost2=s452a gen cost3=s452b gen cost4=s452c gen cost5=s452d 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] * The distribution of birth_order does not match the table; don't know why * 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=s454 if factype2or3==1 replace cost=total if factype2or3==1 & (s454==. | s454==99998) & (total ~=. & total~=99998) ********************************* * Optional: find and correct typos that should be 99998 * tab cost 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