The DHS Program User Forum
Discussions regarding The DHS Program data and results
Home » Topics » Nutrition and Anthropometry » M55 variable missing (Not able to find m55 variable in the data set)
Re: M55 variable missing [message #17472 is a reply to message #17464] Wed, 27 March 2019 07:50 Go to previous messageGo to previous message
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
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Stata Code for child nutrition status
Next Topic: DHS of India 2015/16 and 2005/06
Goto Forum:
  


Current Time: Thu Dec 26 19:32:46 Coordinated Universal Time 2024