Nutritional Status of Women on SPSS and Stata [message #15115] |
Tue, 05 June 2018 09:04 |
Mlue
Messages: 92 Registered: February 2017 Location: North West
|
Senior Member |
|
|
Hi,
Using DHS data, you can replicate parts of the table on nutritional status of women.
I used the Individual Recode file...
Example for India DHS 2015-16 (National Family Health Survey = NFHS-4)
For Stata
/****/
clear all
set more off
set mem 1g
set matsize 800
cd "..."
use "SLIR61FL", clear
**********************************
** WEIGHT VARIABLE
gen weight = v005/1000000
********************************************************************************
** SURVEY SET
gen psu = v021
gen strata = v023
svyset psu [pw = weight], strata(strata) vce(linearized)
*svydes
********************************************************************************
/*
Underweight = Less than 18.5
Normal = Between 18.5 and 24.9
Overweight = Between 25.0 and 29.9
Obese = Greater than or equal to 30.0
*/
gen bmi=v445/100
gen bmic=1 if bmi<18.5
replace bmic=2 if bmi>=18.5 & bmi<25
replace bmic=3 if bmi>=25 & bmi<30
replace bmic=4 if bmi>=30 & bmi<60
label define bmic 1"Underweight" 2"Normal" 3"Overweight" 4"Obese"
label values bmic bmic
svy: tab bmic, count percent format(%4.1f) col
*tab bmic [iw=weight]
gen ht_flag=0
replace ht_flag=1 if v438>9000
gen preg_flag=0
replace preg_flag=1 if v213==1
gen months_since_last_birth=v008-b3_01
gen recent_birth_flag=0
replace recent_birth_flag=1 if months_since_last_birth <=1
*tab bmic if ht_flag==0 & preg_flag==0 & recent_birth_flag==0 [iw=weight]
********************************************************************************
** DROP IF NOT WITHIN SAMPLE
qui regr bmic if bmic !=. & ht_flag==0 & preg_flag==0 & recent_birth_flag==0 [pw=weight]
drop if e(sample)!=1
********************************************************************************
** CHECK
svy: tab v190 bmic, count format(%4.0f) miss
svy: tab v190 bmic, percent format(%4.1f) row miss
**********************************************
For SPSS
************************************************************ *******************************************************.
*/ OPEN DATASET /*.
GET
STATA FILE='...\IAIR72FL.DTA'.
DATASET NAME DataSet1 WINDOW=FRONT.
*******************************************************************************************************************.
** WEIGHT VARIABLE.
COMPUTE weight = v005/1000000.
WEIGHT BY weight.
*******************************************************************************************************************.
** COMPLEX SURVEY VARIABLES.
COMPUTE psu = v021.
COMPUTE strata = v023.
*******************************************************************************************************************.
/**.
** Underweight = Less than 18.5
** Normal = Between 18.5 and 24.9
** Overweight = Between 25.0 and 29.9
** Obese = Greater than or equal to 30.0
**/.
COMPUTE bmi=v445/100.
COMPUTE bmic=$SYSMIS.
IF bmi LT 18.5 bmic = 1.
IF bmi GE 18.5 & bmi LT 25 bmic = 2.
IF bmi GE 25 & bmi LT 30 bmic = 3.
IF bmi GE 30 & bmi LT 60 bmic = 4.
EXECUTE.
VARIABLE LABELS bmic 'Nutritional status of women'.
VALUE LABELS bmic 1"Underweight" 2"Normal" 3"Overweight" 4"Obese".
*COMPUTE bmic1=$SYSMIS.
* IF bmi LT 18.5 bmic1 = 1.
* IF bmi GE 18.5 & bmi LT 25 bmic1 = 2.
* IF bmi GE 25 & bmi LT 30 bmic1 = 3.
* IF bmi GE 30 & bmi LT 60 bmic1= 4.
*EXECUTE.
*******************************************************************************************************************.
COMPUTE ht_flag=1.
IF v438 LT 9000 ht_flag=0.
IF v438 GT 9000 ht_flag=1.
EXECUTE.
*******************************************************************************************************************.
COMPUTE preg_flag=1.
IF v213 NE 1 preg_flag=0.
IF v213=1 preg_flag=1.
EXECUTE.
COMPUTE months_since_last_birth=(v008-b3_01).
EXECUTE.
COMPUTE recent_birth_flag=0.
IF months_since_last_birth GT 1 recent_birth_flag=0.
IF months_since_last_birth LE 1 recent_birth_flag=1.
EXECUTE.
*************************.
SELECT IF ht_flag=0 & preg_flag=0 & recent_birth_flag=0 & bmic LE 4.
*******************************************************************************************************************.
** CHECK.
FREQUENCIES VARIABLES=bmic
/ORDER=ANALYSIS.
*************************.
CROSSTABS
/TABLES=V190 BY bmic
/FORMAT=AVALUE TABLES
/CELLS=COUNT
/COUNT ROUND CELL.
*************************.
CROSSTABS
/TABLES=V190 BY bmic
/FORMAT=AVALUE TABLES
/CELLS=ROW
/COUNT ROUND CELL.
*******************************************************************************************************************.
Mluleki Tsawe
|
|
|
|