The DHS Program User Forum
Discussions regarding The DHS Program data and results
Home » Topics » Nutrition and Anthropometry » Using igrowup SPSS syntax
Re: Using igrowup SPSS syntax [message #17461 is a reply to message #17458] Mon, 25 March 2019 06:38 Go to previous messageGo to previous message
Mlue
Messages: 92
Registered: February 2017
Location: North West
Senior Member
Hello BLM,

Try the following codes (SPSS) to match some of the results in the report. Please note that I have never used igrowup and I'm not sure what it does.
I hope this helps. I have also attached text files with extra syntaxes.

Example for WASTING

*// [ OPEN THE DATA - PR RECODE FILE (MWPR7HFL) ] **.
** CHILD NUTRITIONAL STATUS.
** Table 11.1 Nutritional status of children.
** MALAWI DHS 2015-16 **.
** **.
GET
  FILE='C:\Users\User1\Documents\MW_2015-16_DHS_05242018_253_52565\MW_2015-16_DHS_03042019_835_52565_SPSS\MWPR7HSV\MWPR7HFL.SAV'.
DATASET NAME DataSet1 WINDOW=FRONT.

************************************************************************************************************************************.

** WEIGHT VARIABLE.
COMPUTE weight = hv005/1000000.

WEIGHT BY weight.

** COMPLEX SURVEY VARIABLES.
COMPUTE psu = hv021.
COMPUTE strata = hv023.

************************************************************************************************************************************.

RENAME VARIABLES (hc27 = sex) (hv270 = wealth) (hv025 = residence) (hv024 = region).

************************************************************************************************************************************.

** CHILD AGE IN MONTHS.
RECODE hc1 (0 THRU 5 = 1) (6 THRU 8 = 2) (9 THRU 11 = 3) 
(12 THRU 17 = 4) (18 THRU 23 = 5) (24 THRU 35 = 6) (36 THRU 47 = 7) 
(48 THRU 59 = 8) INTO child_age.
VARIABLE LABELS child_age 'Child age (months)'.
EXECUTE.
VALUE LABELS child_age 1 "0-5 months" 2 "6-8 months" 3 "9-11 months" 4 "12-17 months" 5 "18-23 months" 6 "24-35 months" 7 "36-47 months" 8 "48-59 months".

SELECT IF child_age  LE 8.

************************************************************************************************************************************.

** WASTING = Weight-for-height.
COMPUTE wasting=$SYSMIS.
      IF hv103=1 wasting=0.
      IF missing(hc72) wasting=$SYSMIS.
      IF (hc72>=9996) wasting= $SYSMIS.
      IF (hc72 LT -200 AND hv103=1) wasting = 1.
EXECUTE.
VARIABLE LABELS wasting 'Wasting children'.
VALUE LABELS wasting 0 "Not wasting" 1 "Wasting" .

************************************************************************************************************************************.
************************************************************************************************************************************.
************************************************************************************************************************************..
************************************************************************************************************************************.
************************************************************************************************************************************.

SELECT IF wasting LE 1.

** CHECK.
FREQUENCIES VARIABLES= wasting
  /ORDER=ANALYSIS.

************************************************************************************************************************************.

CROSSTABS
  /TABLES=child_age sex wealth residence region BY wasting
  /FORMAT=AVALUE TABLES
  /CELLS=ROW
  /COUNT ROUND CELL.

CROSSTABS
  /TABLES=child_age sex wealth residence region BY wasting
  /FORMAT=AVALUE TABLES
  /CELLS=COUNT
  /COUNT ROUND CELL.

************************************************************************************************************************************.
/* COMPLEX SURVEYS */.

* Analysis Preparation Wizard.
CSPLAN ANALYSIS
  /PLAN FILE='C:\Users\User1\Documents\MW_2015-16_DHS_05242018_253_52565\MAMAWIDHS2015_16_PRCSPLAN.csaplan'
  /PLANVARS ANALYSISWEIGHT=weight
  /SRSESTIMATOR TYPE=WOR
  /PRINT PLAN
  /DESIGN STRATA=strata CLUSTER=psu
  /ESTIMATOR TYPE=WR.

****************************************.

* Complex Samples Frequencies.
CSTABULATE
  /PLAN FILE='C:\Users\User1\Documents\MW_2015-16_DHS_05242018_253_52565\MAMAWIDHS2015_16_PRCSPLAN.csaplan'
  /TABLES VARIABLES=wasting
  /CELLS POPSIZE TABLEPCT
  /STATISTICS DEFF
  /MISSING SCOPE=TABLE CLASSMISSING=EXCLUDE.

* Complex Samples Crosstabs.
CSTABULATE
  /PLAN FILE='C:\Users\User1\Documents\MW_2015-16_DHS_05242018_253_52565\MAMAWIDHS2015_16_PRCSPLAN.csaplan'
  /TABLES VARIABLES=child_age sex wealth residence region BY wasting
  /CELLS ROWPCT
  /STATISTICS CV
  /MISSING SCOPE=TABLE CLASSMISSING=EXCLUDE.

I also don't know why you want to merge the PR and KR files. Nonetheless, the following code will assist with the merging.

Example for MERGING PR and KR files

/**    BEFORE YOU START.
*      PLEASE MAKE SURE THAT THE PR & KR DATA FILES ARE SAVED ON THE SAME FOLDER
**/

**** OPEN THE KR FILE ****.
GET
  FILE='C:\Users\User1\Documents\MW_2015-16_DHS_05242018_253_52565\KR_PR DATA\MWKR7HFL.SAV'.
DATASET NAME KR_Dataset WINDOW=FRONT.

COMPUTE line=B16.
SORT CASES BY V001(A) V002(A) line(A).

SAVE OUTFILE ="C:\Users\User1\Documents\MW_2015-16_DHS_05242018_253_52565\KR_PR DATA\MWKR7HFLtemp.SAV".

***************************************************.

**** OPEN THE PR FILE ****.
GET
  FILE='C:\Users\User1\Documents\MW_2015-16_DHS_05242018_253_52565\KR_PR DATA\MWPR7HFL.SAV'.
DATASET NAME PR_Dataset WINDOW=FRONT.

COMPUTE V001=HV001.
COMPUTE V002=HV002.
COMPUTE line=HVIDX.
SORT CASES BY V001(A) V002(A) line(A).

SAVE OUTFILE = "C:\Users\User1\Documents\MW_2015-16_DHS_05242018_253_52565\KR_PR DATA\MWPR7HFLtemp.SAV".
DATASET CLOSE KR_Dataset.

***************************************************.

**** THE MERGE (ONE TO MANY) ****.

*MATCH FILES FILE = "C:\Users\User1\Documents\MW_2015-16_DHS_05242018_253_52565\KR_PR DATA\MWKR7HFLtemp.SAV"  /IN=inKRfile
    /TABLE = "C:\Users\User1\Documents\MW_2015-16_DHS_05242018_253_52565\KR_PR DATA\MWPR7HFLtemp.SAV"   /IN=inPRfile
     /BY V001 V002 line.

MATCH FILES FILE="C:\Users\User1\Documents\MW_2015-16_DHS_05242018_253_52565\KR_PR DATA\MWKR7HFLtemp.SAV"  /IN=inKRfile
  /FILE= "C:\Users\User1\Documents\MW_2015-16_DHS_05242018_253_52565\KR_PR DATA\MWPR7HFLtemp.SAV"  /IN=inPRfile
  /BY V001 V002 line.
SELECT IF inPRfile EQ 1.
DATASET CLOSE PR_Dataset.
DATASET NAME MERGED_Dataset WINDOW=FRONT.

SAVE OUTFILE = "C:\Users\User1\Documents\MW_2015-16_DHS_05242018_253_52565\KR_PR DATA\MERGED_KR_PR_MALAWI.SAV".
 
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Iodine intake of children
Next Topic: POSTNATAL CARE FOR MOTHER & NEWBORN IN Stata
Goto Forum:
  


Current Time: Fri Nov 8 21:08:36 Coordinated Universal Time 2024