| micronutrient intake [message #16759] | 
			Wed, 27 February 2019 18:49   | 
		 
		
			
				
				
				
					
						  
						abebe
						 Messages: 10 Registered: February 2019 
						
					 | 
					Member  | 
					 | 
		 
		 
	 | 
 
	| 
		Hello, I am trying to see the factors affecting vitamin A intake of children from the 2005, 2011 and 2016 Ethiopian dataset. I am using the childrens dataset and since food intake was collected from the youngest children living with  their mother, can you help me how I can identify the youngest children in SPSS?
		
		
		
 |  
	| 
		
	 | 
 
 
 | 
	
		
		
			| Re: micronutrient intake [message #16767 is a reply to message #16759] | 
			Fri, 01 March 2019 05:24   | 
		 
		
			
				
				
				
					
						
						Mlue
						 Messages: 92 Registered: February 2017  Location: North West
						
					 | 
					Senior Member  | 
					 | 
		 
		 
	 | 
 
	
		Hello Abebe, 
 
You can try the following codes (for each year). Note that for 2005, the age-range was children age 6-35 months while it was 6-23 months for the other years. 
 
 
 FOR 2005 DATA  
GET
  FILE='C:\Users\User1\Documents\ETHIOPIA DHS - 2005\ETBR51FL.SAV'.
DATASET NAME DataSet1 WINDOW=FRONT.
********************************************************************************************.
** GENERATE THE WEIGHT VARIABLE & WEIGHT DATA **.
COMPUTE weight = v005/1000000.
WEIGHT BY weight.
********************************************************************************************.
** COMPLEX SURVEY VARIABLES (equivalent to Stata's svyset) **.
COMPUTE psu = v021.
COMPUTE strata = v023.
********************************************************************************************.
** RENAME A FEW VARIABLES TO BE USE IN ANALYSIS **.
RENAME VARIABLES (v013 = age) (v106 = education) (v190 = wealth) (v025 = residence) (v024 = region).
********************************************************************************************.
** CREATING THE INDICATOR VARIABLE (DEPENDENT VARIABLE) **.
** CHILD AGE = [COMPUTE child_age = b19] FOR RECENT SURVEYS.
COMPUTE child_age = v008 - b3.
RECODE child_age (0 THRU 1 = 1) (2 THRU 3 = 2) (4 THRU 5 = 3) (6 THRU 8 = 4) 
(9 THRU 11 = 5) (12 THRU 17 = 6) (18 THRU 23 = 7) (ELSE = 0) INTO child_age_grp.
VARIABLE LABELS child_age_grp "Child's age in months - grouped".
VALUE LABELS child_age_grp 1 "0-1 months" 2 "2-3 months" 3 "4-5 months" 4 "6-8 months" 5 "9-11 months" 6 "12-17 months" 7 "18-23 months".
EXECUTE.
********************************************************************************************.
* keep only if child is living with the mother.
SELECT IF b9 EQ 0.
********************************************************************************************.
* Finding the youngest child living with the mother for each mother.
AGGREGATE 
   /OUTFILE=* MODE=ADDVARIABLES OVERWRITE=YES
   /BREAK v001 v002 v003 
   /hhsize  'Household size' = n
   /minbidx 'MINBIDX' =min(bidx).
EXECUTE.
* need to drop those that are bidx==2 and minbidx==1.
SELECT IF bidx LE minbidx.
********************************************************************************************.
/** VARIABLES **/.
   
*// eggs, any meat, organ meat, fish/shellfish.
COMPUTE MeatF =0.
   IF (S470J=1 | S470K=1 | S470L=1 | S470M=1 | S470N=1) MeatF = 1.
VALUE LABELS MeatF 0"No" 1"Yes" .
EXECUTE.
*// fruits & vegetables rich in vitamin A.
COMPUTE Fruits =0.
   IF (S470F=1 | S470G=1 | S470H =1) Fruits = 1.
VALUE LABELS Fruits 0"No" 1"Yes" .
EXECUTE.
*// Percentage who consumed foods rich in vitamin A in past 24 hours .
COMPUTE VitaminA =0.
   IF (Fruits = 1 | MeatF=1) VitaminA = 1.
VARIABLE LABELS VitaminA "Percentage who consumed foods rich in vitamin A in past 24 hours".
VALUE LABELS VitaminA 0"No" 1"Yes" .
EXECUTE.
*// Percentage who consumed foods rich in iron in past 24 hours.
COMPUTE Iron =0.
   IF (MeatF = 1) Iron = 1.
VARIABLE LABELS Iron "Percentage who consumed foods rich in iron in past 24 hours".
VALUE LABELS Iron 0"No" 1"Yes" .
EXECUTE.
********************************************************************************************.
** SELECT CHILDREN AGED 6-35 MONTHS (it was up to 35 months in 2005) **.
SELECT IF RANGE(child_age,6,35).
********************************************************************************************.
 /** CHECK - note that you may have to use complex surveys to match the results in the report **/.
FREQUENCIES VARIABLES= MeatF Fruits VitaminA Iron
  /ORDER=ANALYSIS.
CROSSTABS
  /TABLES=wealth BY VitaminA Iron
  /FORMAT=AVALUE TABLES
  /CELLS=ROW
  /COUNT ROUND CELL.
********************************************************************************************.
/** COMPLEX SURVEYS **/.
* Analysis Preparation Wizard.
CSPLAN ANALYSIS
  /PLAN FILE='C:\Users\User1\Documents\ETHIOPIA DHS - 2005\ETDHS2005_CSPLAN.csaplan'
  /PLANVARS ANALYSISWEIGHT=weight
  /SRSESTIMATOR TYPE=WOR
  /PRINT PLAN
  /DESIGN STRATA=strata CLUSTER=psu
  /ESTIMATOR TYPE=WR.
********************************************************************************************.
 /** CHECK **/.
* Complex Samples Frequencies.
CSTABULATE
  /PLAN FILE='C:\Users\User1\Documents\ETHIOPIA DHS - 2005\ETDHS2005_CSPLAN.csaplan'
  /TABLES VARIABLES=child_age_grp VitaminA Iron
  /CELLS POPSIZE TABLEPCT
  /STATISTICS DEFF
  /MISSING SCOPE=TABLE CLASSMISSING=EXCLUDE.
****************************.
** CROSSTABS **.
* Complex Samples Crosstabs.
CSTABULATE
  /PLAN FILE='C:\Users\User1\Documents\ETHIOPIA DHS - 2005\ETDHS2005_CSPLAN.csaplan'
  /TABLES VARIABLES=child_age_grp b4 residence region education wealth BY VitaminA
  /CELLS ROWPCT
  /STATISTICS CV
  /MISSING SCOPE=TABLE CLASSMISSING=EXCLUDE.
* Complex Samples Crosstabs.
CSTABULATE
  /PLAN FILE='C:\Users\User1\Documents\ETHIOPIA DHS - 2005\ETDHS2005_CSPLAN.csaplan'
  /TABLES VARIABLES=child_age_grp b4 residence region education wealth BY Iron
  /CELLS ROWPCT
  /STATISTICS CV
  /MISSING SCOPE=TABLE CLASSMISSING=EXCLUDE.
********************************************************************************************.
  
 
 FOR 2011 DATA  
** I  USED A Stata FILE HERE (I DID NOT HAVE THE SPSS FILE FOR 2011 WHEN WRITING THIS CODE).
GET
  STATA FILE='C:\Users\User1\Desktop\FINAL FORMATIONS ON STATA - CS 2016\Census 1996 formations\ETHIOPIA DHS 2011\ETBR61FL.DTA'.
DATASET NAME DataSet1 WINDOW=FRONT.
********************************************************************************************.
** GENERATE THE WEIGHT VARIABLE & WEIGHT DATA **.
COMPUTE weight = v005/1000000.
WEIGHT BY weight.
********************************************************************************************.
** COMPLEX SURVEY VARIABLES (equivalent to Stata's svyset) **.
COMPUTE psu = v021.
COMPUTE strata = v023.
********************************************************************************************.
** RENAME A FEW VARIABLES TO BE USE IN ANALYSIS **.
RENAME VARIABLES (v013 = age) (v106 = education) (v190 = wealth) (v025 = residence) (v024 = region).
********************************************************************************************.
** CREATING THE INDICATOR VARIABLE (DEPENDENT VARIABLE) **.
** CHILD AGE = [COMPUTE child_age = b19] FOR RECENT SURVEYS.
COMPUTE child_age = v008 - b3.
RECODE child_age (0 THRU 1 = 1) (2 THRU 3 = 2) (4 THRU 5 = 3) (6 THRU 8 = 4) 
(9 THRU 11 = 5) (12 THRU 17 = 6) (18 THRU 23 = 7) (ELSE = 0) INTO child_age_grp.
VARIABLE LABELS child_age_grp "Child's age in months - grouped".
VALUE LABELS child_age_grp 1 "0-1 months" 2 "2-3 months" 3 "4-5 months" 4 "6-8 months" 5 "9-11 months" 6 "12-17 months" 7 "18-23 months".
EXECUTE.
********************************************************************************************.
* keep only if child is living with the mother.
SELECT IF b9 EQ 0.
********************************************************************************************.
* Finding the youngest child living with the mother for each mother.
AGGREGATE 
   /OUTFILE=* MODE=ADDVARIABLES OVERWRITE=YES
   /BREAK v001 v002 v003 
   /hhsize  'Household size' = n
   /minbidx 'MINBIDX' =min(bidx).
EXECUTE.
* need to drop those that are bidx==2 and minbidx==1.
SELECT IF bidx LE minbidx.
********************************************************************************************.
/** VARIABLES **/.
   
*// eggs, any meat, organ meat, fish/shellfish.
COMPUTE MeatF =0.
   IF ( V414G=1 | V414H=1 | V414M=1 | V414N=1) MeatF = 1.
VALUE LABELS MeatF 0"No" 1"Yes" .
EXECUTE.
*// fruits & vegetables rich in vitamin A.
COMPUTE Fruits =0.
   IF ( V414I = 1 | V414J =1 | V414K=1 ) Fruits = 1.
VALUE LABELS Fruits 0"No" 1"Yes" .
EXECUTE.
*// Percentage who consumed foods rich in vitamin A in past 24 hours1 .
COMPUTE VitaminA =0.
   IF ( Fruits = 1 | MeatF ) VitaminA = 1.
VARIABLE LABELS VitaminA "Percentage who consumed foods rich in vitamin A in past 24 hours".
VALUE LABELS VitaminA 0"No" 1"Yes" .
EXECUTE.
*// Percentage who consumed foods rich in iron in past 24 hours 2.
COMPUTE Iron =0.
   IF ( MeatF = 1 ) Iron = 1.
VARIABLE LABELS Iron "Percentage who consumed foods rich in iron in past 24 hours".
VALUE LABELS Iron 0"No" 1"Yes" .
EXECUTE.
********************************************************************************************.
** SELECT CHILDREN AGED 6-23 MONTHS **.
SELECT IF RANGE(child_age,6,23).
********************************************************************************************.
 /** CHECK - note that you may have to use complex surveys to match the results in the report **/.
FREQUENCIES VARIABLES=child_age_grp Iron VitaminA
  /ORDER=ANALYSIS.
********************************************************************************************.
  
 
 
 FOR 2016 DATA  
** I  USED A Stata FILE HERE (I DID NOT HAVE THE SPSS FILE FOR 2016 WHEN WRITING THIS CODE).
GET
  STATA FILE='C:\Users\User1\Desktop\FINAL FORMATIONS ON STATA - CS 2016\Census 1996 formations\ETHIOPIA DHS 2016\ETBR70FL.DTA'.
DATASET NAME DataSet1 WINDOW=FRONT.
********************************************************************************************.
** GENERATE THE WEIGHT VARIABLE & WEIGHT DATA **.
COMPUTE weight = v005/1000000.
WEIGHT BY weight.
********************************************************************************************.
** COMPLEX SURVEY VARIABLES (equivalent to Stata's svyset) **.
COMPUTE psu = v021.
COMPUTE strata = v023.
********************************************************************************************.
** RENAME A FEW VARIABLES TO BE USE IN ANALYSIS **.
RENAME VARIABLES (v013 = age) (v106 = education) (v190 = wealth) (v025 = residence) (v024 = region).
********************************************************************************************.
** CREATING THE INDICATOR VARIABLE (DEPENDENT VARIABLE) **.
** CHILD AGE.
COMPUTE child_age = b19.
RECODE child_age (0 THRU 1 = 1) (2 THRU 3 = 2) (4 THRU 5 = 3) (6 THRU 8 = 4) 
(9 THRU 11 = 5) (12 THRU 17 = 6) (18 THRU 23 = 7) (ELSE = 0) INTO child_age_grp.
VARIABLE LABELS child_age_grp "Child's age in months - grouped".
VALUE LABELS child_age_grp 1 "0-1 months" 2 "2-3 months" 3 "4-5 months" 4 "6-8 months" 5 "9-11 months" 6 "12-17 months" 7 "18-23 months".
EXECUTE.
********************************************************************************************.
* keep only if child is living with the mother.
SELECT IF b9 EQ 0.
********************************************************************************************.
* Finding the youngest child living with the mother for each mother.
AGGREGATE 
   /OUTFILE=* MODE=ADDVARIABLES OVERWRITE=YES
   /BREAK v001 v002 v003 
   /hhsize  'Household size' = n
   /minbidx 'MINBIDX' =min(bidx).
EXECUTE.
* need to drop those that are bidx==2 and minbidx==1.
SELECT IF bidx LE minbidx.
********************************************************************************************.
/** VARIABLES **/.
   
*// eggs, any meat, organ meat, fish/shellfish.
COMPUTE MeatF =0.
   IF ( V414G=1 | V414H=1 | V414M=1 | V414N=1) MeatF = 1.
VALUE LABELS MeatF 0"No" 1"Yes" .
EXECUTE.
*// fruits & vegetables rich in vitamin A.
COMPUTE Fruits =0.
   IF ( V414I = 1 | V414J =1 | V414K=1 ) Fruits = 1.
VALUE LABELS Fruits 0"No" 1"Yes" .
EXECUTE.
*// Percentage who consumed foods rich in vitamin A in past 24 hours1 .
COMPUTE VitaminA =0.
   IF ( Fruits = 1 | MeatF ) VitaminA = 1.
VARIABLE LABELS VitaminA "Percentage who consumed foods rich in vitamin A in past 24 hours".
VALUE LABELS VitaminA 0"No" 1"Yes" .
EXECUTE.
*// Percentage who consumed foods rich in iron in past 24 hours 2.
COMPUTE Iron =0.
   IF ( MeatF = 1 ) Iron = 1.
VARIABLE LABELS Iron "Percentage who consumed foods rich in iron in past 24 hours".
VALUE LABELS Iron 0"No" 1"Yes" .
EXECUTE.
********************************************************************************************.
** SELECT CHILDREN AGED 6-23 MONTHS **.
SELECT IF RANGE(child_age,6,23).
********************************************************************************************.
 /** CHECK - note that you may have to use complex surveys to match the results in the report **/.
FREQUENCIES VARIABLES= VitaminA Iron
  /ORDER=ANALYSIS.
********************************************************************************************.
  
		
		
		
 |  
	| 
		
	 | 
 
 
 |