Home » Topics » Nutrition and Anthropometry » M55 variable missing (Not able to find m55 variable in the data set)
M55 variable missing [message #17464] |
Mon, 25 March 2019 19:32 |
dnameispaone
Messages: 19 Registered: February 2019
|
Member |
|
|
Hi all,
I trying to calculate the prevalence of pre-lacteal feed and its determinants. However, there is no m55 variable in NFHS-4 India data sets. There are other m55 variables like m55a and so on.
I am using the child data sets.
How can I calculate the prevalence of pre-lacteal feed?
|
|
|
Re: M55 variable missing [message #17472 is a reply to message #17464] |
Wed, 27 March 2019 07:50 |
Mlue
Messages: 92 Registered: February 2017 Location: North West
|
Senior Member |
|
|
Hello dnameispaone,
You can try teh following code.
For prelacteal feeding
*** EVER BREASTFED (ONLY LAST-BORN CHILDREN)
/*FOR ALL CHILDREN BLOCK THE STATEMENT WHICH STATES (drop if bidx>minbidx)*/
cap drop ever_breastfed
recode m4 (94=0 "No") (else=1 "Yes"), gen(ever_breastfed)
label var ever_breastfed "Ever breastfed"
label var ever_breastfed "Child ever breastfed?"
label val ever_breastfed ever_breastfed
*** PRELACTEAL FEEDING
cap drop prelacteal
gen prelacteal=0 if ever_breastfed==1
label define prelacteal 0"No" 1"Yes"
label var prelacteal "Percentage who received a prelacteal feed"
label val prelacteal prelacteal
foreach xvar of varlist m55a-m55j m55k m55x {
replace prelacteal=1 if `xvar'==1
}
*
To match some figures in the report
clear all
set matsize 800
set maxvar 10000
set mem 1g
cd "C:\Users\User1\Documents\INDIA DHS"
use "IAKR72FL", clear
set more off
** <><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><> **
** WEIGHT VARIABLE
gen weight = v005/1000000
** <><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><> **
** SURVEY SET
gen psu = v021
gen strata = v023
svyset psu [pw = weight], strata(strata) vce(linearized)
*svydes
** <><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><> **
gen hhid=substr(caseid,1,12)
sort hhid
* Generate "pid"
by hhid: gen pid = _n
* Creating household size
by hhid: generate hhsize=_N
egen hhtag = tag(hhid)
*br hhid midx pid hhsize hhtag v024 v025
** <><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><> **
// RENAME
rename v013 age_woman
rename v106 education
rename v190 wealth
rename v025 residence
rename v024 region
rename sdistri district
** <><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><> **
// GENERATING DEPENDENT VARIABLES
capture confirm variable b19
if _rc {
gen b19 = v008 - b3
label variable b19 "current age of child in months (months since birth for dead children)"
}
*
gen child_age=b19
recode child_age (0/1=1 "0-1") (2/3=2 "2-3") (4/5=3 "4-5") (6/8=4 "6-8") ///
(9/11=5 "9-11") (12/17=6 "12-17") (18/23=7 "18-23") (else=.), gen(child_age_grp)
* keep only children less than 2 years
keep if child_age<24
*keep if b9==0
* finding the youngest child living with the mother for each mother
bysort v001 v002 v003: egen minbidx=min(bidx)
* need to drop those that are bidx==2 and minbidx==1
drop if bidx>minbidx
/*keep if bidx <= minbidx*/
** <><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><> **
*** EVER BREASTFED (ONLY LAST-BORN CHILDREN)
/*FOR ALL CHILDREN BLOCK THE STATEMENT WHICH STATES (drop if bidx>minbidx)*/
cap drop ever_breastfed
recode m4 (94=0 "No") (else=1 "Yes"), gen(ever_breastfed)
label var ever_breastfed "Ever breastfed"
label var ever_breastfed "Child ever breastfed?"
label val ever_breastfed ever_breastfed
*** PRELACTEAL FEEDING
cap drop prelacteal
gen prelacteal=0 if ever_breastfed==1
label define prelacteal 0"No" 1"Yes"
label var prelacteal "Percentage who received a prelacteal feed"
label val prelacteal prelacteal
foreach xvar of varlist m55a-m55j m55k m55x {
replace prelacteal=1 if `xvar'==1
}
*
*** CHILD BREASTFED WITHIN ONE HOUR **/
recode m34 (0/100=1 "Yes") (else=0 "No"), gen(within_hour)
label var within_hour "Child put to breast within an hour?"
label val within_hour within_hour
*** CHILD BREASTFED WITHIN ONE DAY **/
recode m34 (0/200=1 "Yes") (else=0 "No"), gen(within_one_day)
*label var within_one_day "Child put to breast within one day?"
*label val within_one_day within_one_day
*** DELIVERY
cap drop place_delivery
recode m15 (21/36=1 "Health facility") (11/13=2 "At home") ///
(else=3 "Other/Missing"), gen(place_delivery)
label var place_delivery "Place of delivery"
label val place_delivery place_delivery
*** SKILLED BIRTH ATTENDANT
cap drop skilled_birth
gen skilled_birth = 3
replace skilled_birth = 1 if m3a==1 | m3b==1 | m3c==1
replace skilled_birth = 2 if m3g==1 & (skilled_birth!=1)
label define skilled_birth 1"Health personnel" 2"Dai (TBA)" 3"Other" 4"Other/no one"
label var skilled_birth "Birth delivered by skilled birth attendant"
label val skilled_birth skilled_birth
*** YEARS OF EDUCATION
cap drop education_years
recode v133 (0=0 "No schooling") (1/4=1 "<5 years") (5/7=2 "5-7 years") ///
(8/9=3 "8-9 years") (10/11=4 "10-11 years") ///
(12/max=5 "12+ years"), gen(education_years)
label var education_years "Years of education - grouped"
label val education_years education_years
*** RELIGION
cap drop religion
recode v130 (1=1 "Hindu") (2=2 "Muslim") (3=3 "Christian") ///
(4=4 "Sikh") (5=5 "Buddhist/Neo-Buddhist") (6=6 "Jain") ///
(7/96=7 "Other"), gen(religion)
label var religion "Religious affiliation"
label val religion religion
*** CASTE OR TRIBE
cap drop caste_tribe
recode s116 (1=1 "Scheduled caste") (2=2 "Scheduled tribe") ///
(3=3 "Other backward class") (4 .=4 "Other") (8=5 "Don't know"), gen(caste_tribe)
label var caste_tribe "Caste or tribe"
label val caste_tribe caste_tribe
** <><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><> **
** DROP IF NOT WITHIN SAMPLE
keep if prelacteal !=.
*qui regr prelacteal if v208 !=0 [pw=weight]
*drop if e(sample)!=1
** <><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><> **
** CHECK:
** Table 10.4 Percentage who received a prelacteal feed **
svy: tab residence prelacteal, percent format(%4.1f) row
svy: tab b4 prelacteal, percent format(%4.1f) row
svy: tab education_years prelacteal, percent format(%4.1f) row
svy: tab religion prelacteal, percent format(%4.1f) row
svy: tab caste_tribe prelacteal, percent format(%4.1f) row
svy: tab skilled_birth prelacteal, percent format(%4.1f) row
svy: tab place_delivery prelacteal, percent format(%4.1f) row
svy: tab wealth prelacteal, percent format(%4.1f) row
svy: tab region prelacteal, percent format(%4.1f) row
|
|
|
|
Re: M55 variable missing [message #17498 is a reply to message #17497] |
Mon, 01 April 2019 18:50 |
Mlue
Messages: 92 Registered: February 2017 Location: North West
|
Senior Member |
|
|
I'm glad I could help,
To estimate the standard errors or confidence intervals for some of your analysis, please try to change the svyset command statement to:
svyset psu [pw = weight], strata(strata) singleunit(centered)
[Updated on: Mon, 01 April 2019 21:37] Report message to a moderator
|
|
|
|
|
|
Re: M55 variable missing [message #17609 is a reply to message #17606] |
Fri, 26 April 2019 10:31 |
Mlue
Messages: 92 Registered: February 2017 Location: North West
|
Senior Member |
|
|
Hello,
This will point you in the right direction. The code is supposed to work, but I think I'm missing something.
I'm not getting the exact percentages (maybe one of the DHS experts with assist you).
/*
EXCLUSIVE BREASTFEEDING
National Family Health Survey (NFHS-4)
India 2015-16
*/
clear all
set matsize 800
set maxvar 10000
set mem 1g
cd "C:\Users\MlulekiT\Documents\INDIA DHS"
use "IAKR72FL", clear
set more off
** ========================================================================== **
** WEIGHT VARIABLE
gen weight = v005/1000000
** ========================================================================== **
** SURVEY SET
gen psu = v021
//gen strata = v022
gen strata = v023
svyset psu [pw = weight], strata(strata) singleunit(scaled)
** ========================================================================== **
sort caseid
** HHID
gen hhid=substr(caseid,1,12)
sort hhid
** PID
bys hhid: gen pid=_n
** HHSIZE
bys hhid: gen hhsize=_N
** HHTAG
egen hhtag=tag(hhid)
** ========================================================================== **
// RENAME
rename v013 age
rename v106 education
rename v190 wealth
rename v025 residence
rename v024 region
** ========================================================================== **
// GENERATING DEPENDENT VARIABLES
** Child age
// if b19 does not exist use: gen b19 = v008-b3
*lookfor b19
capture confirm variable b19
if _rc {
gen b19 = v008 - b3
label variable b19 "current age of child in months (months since birth for dead children)"
}
*
gen child_age=b19
recode child_age (0/1=1 "0-1") (2/3=2 "2-3") (4/5=3 "4-5") (6/8=4 "6-8") ///
(9/11=5 "9-11") (12/17=6 "12-17") (18/23=7 "18-23") (else=.), gen(child_age_grp)
keep if child_age_grp !=.
** ========================================================================== **
** Child lives with respondent
keep if b9==0
** ========================================================================== **
* finding the youngest child living with the mother for each mother
bysort v001 v002 v003: egen minbidx=min(bidx)
* keep only children less than 2 years
keep if child_age<24
* need to drop those that are bidx==2 and minbidx==1
drop if bidx>minbidx
** ========================================================================== **
gen water=0
gen liquids=0
gen milk=0
gen solids=0
gen breast=0
gen bottle=0
*TO DETERMINE IF CHILD IS GIVEN WATER, SUGAR WATER, JUICE, TEA OR OTHER.
replace water=1 if (v409>=1 & v409<=7)
* IF GIVEN OTHER LIQUIDS
foreach xvar of varlist v409a v410 v410* v413* {
replace liquids=1 if `xvar'>=1 & `xvar'<=7
}
*
cap replace liquids=1 if v412c>=1 & v412c<=7
* IF GIVEN POWDER/TINNED milk, FORMULA OR FRESH milk
foreach xvar of varlist v411 v411a v412 v414p {
replace milk=1 if `xvar'>=1 & `xvar'<=7
}
*
* IF STILL BREASTFEEDING
replace breast=1 if m4==95
* IF WAS EVER BOTTLE FED
replace bottle=1 if m38==1
*IF GIVEN ANY SOLID FOOD
foreach xvar of varlist v414* {
replace solids=1 if `xvar'>=1 & `xvar'<=7
}
replace solids=1 if v412a==1 | v412b==1
gen diet=7
replace diet=0 if water==0 & liquids==0 & milk==0 & solids==0
replace diet=1 if water==1 & liquids==0 & milk==0 & solids==0
replace diet=2 if liquids==1 & milk==0 & solids==0
replace diet=3 if milk==1 & solids==0
replace diet=4 if milk==0 & solids==1
replace diet=5 if milk==1 & solids==1
replace diet=6 if breast==0
label define diet 0"given only water" 1"given only liquids" 2"given only milks" ///
3"given only solids" 4"given only milk and solids" 5"not still breastfeeding" ///
6"not now being breastfed" 7"What"
label var diet "Breastfeeding status1"
label val diet diet
gen ebf=0
replace ebf=1 if diet==0
** ========================================================================== **
** FEEDING
gen feeding=1
replace feeding=2 if water==1
replace feeding=3 if liquids==1
replace feeding=4 if milk==1
replace feeding=5 if solids==1
replace feeding=0 if breast==0
label define feeding 0 "Not breastfeeding" 1 "Exclusive breastfeeding" 2 "+Water" 3 "+Liquids" 4 "+Other Milk" 5 "+Solids"
label val feeding feeding
*creating the predominant breastfeeding variable.
recode feeding (0 4 5=0) (1/3=1), gen(predom)
*==============================================================================*
** DROP IF NOT WITHIN SAMPLE
qui regr feeding if v208 !=0 [pw=weight]
drop if e(sample)!=1
** ========================================================================== **
** CHECK
svy: tab child_age_grp feeding, count format(%4.0f)
svy: tab child_age_grp feeding, percent format(%4.1f) row
** ========================================================================== **
** Exclusive breastfeeding
recode feeding (1=1 "Exclusive") (else=0 "Not exclusive"), gen(exclusive_feed)
label var exclusive_feed "Breastfeeding and consuming complementary foods"
label val exclusive_feed exclusive_feed
svy: tab exclusive_feed, count format(%4.0f) miss
svy: tab child_age_grp exclusive_feed, percent format(%4.1f) row
exit
|
|
|
|
Goto Forum:
Current Time: Fri Nov 8 18:41:55 Coordinated Universal Time 2024
|