The DHS Program User Forum
Discussions regarding The DHS Program data and results
Home » Topics » General » GENERAL SMOKING PREVALENCE IN RWANDA
Re: GENERAL SMOKING PREVALENCE IN RWANDA [message #11854 is a reply to message #11853] Mon, 20 February 2017 18:53 Go to previous message
Mlue
Messages: 92
Registered: February 2017
Location: North West
Senior Member
In case you are using SPSS

Smoking prevalence in Rwanda 2014-15 ... Women's file

** OPEN THE SPSS (DHS MEN'S) DATASET AND THEREAFTER OPEN THIS SPSS SYNTAX
** RIGHT-CLICK, AND SELECT RUN ALL
** OR YOU CAN "HIGHLIGHT" EACH STEP AND THEN "RIGHT-CLICK" AND SELECT "RUN SELECTION"

** IN ORDER TO FULLY REPLICATE THE TABLES IN THE DHS REPORT, IT IS BEST TO USE COMPLEX SURVEY ANALYSIS 
WHICH IS EQUIVALENT TO SURVEYSET IF YOU WERE USING STATA **

**===========================================================================*

* CHANGE PATH BELOW TO THE PARTICULAR FOLDER WHERE YOUR SPSS DATA IS LOCATED
** (create a folder under "MY DOCUMENTS" and save it as "RWANDA - 2014-15 DHS"), then where Dubile appears, change to your Computer name
** To get your Computer name: click on "My Computer / Computer", then right-click ==> "Properties" ==> "Computer description = your computer name

GET
  FILE='C:\Users\Dubile\Documents\RWANDA - 2014-15 DHS\RWMR70FL.SAV'.
DATASET NAME DataSet1 WINDOW=FRONT.

***************************************************************************************************************************

* WEIGHT VARIABLE

COMPUTE weight=mv005 / 1000000.
VARIABLE LABELS  weight 'wgt'.
EXECUTE.

*=============================================================================*

** EDUCATION RECODE

RECODE MV106 (0=0) (1=1) (2 thru 3=2) INTO education.
VALUE LABELS education 0"No education" 1"Primary" 2"Secondary/higher".
VARIABLE LABELS  education 'Recode for education.'.
EXECUTE.

** AGE 50-59 YEARS OLD

RECODE MV012 (15 THRU 49 = 0) (50 THRU 59 = 1)  INTO aged_50to59.
VALUE LABELS aged_50to59 0"15-49" 1"50-59".
VARIABLE LABELS  aged_50to59 'Persons aged 50-59 years.'.
EXECUTE.

/***************************************************************************************************************************/

** COMPLEX SURVEY ANALYSIS - EQUIVALENT OF SURVEYSET
** change Dubile to your computer name

CSPLAN ANALYSIS
  /PLAN FILE='C:\Users\Dubile\Documents\RWANDA - 2014-15 DHS\Plan1.csaplan'
  /PLANVARS ANALYSISWEIGHT=weight
  /SRSESTIMATOR TYPE=WOR
  /PRINT PLAN
  /DESIGN STRATA=mv022 CLUSTER=mv021
  /ESTIMATOR TYPE=WR.


 *** DERIVING VARIABLE = SMOKING CIGARETTES 

RECODE MV463A (1=1) (0=0) (9=0) (ELSE=0) INTO cigarettes.
VALUE LABELS cigarettes 0"No" 1"Yes".
VARIABLE LABELS  cigarettes 'Smokes cigarettes.'.
EXECUTE.

/***************************************************************************************************************************/

* CHECK IF CORRECT USING COMPLEX SURVEY FREQUENCIES (should be the same as in the report)

** TABLE

CSTABULATE
  /PLAN FILE='C:\Users\Dubile\Documents\RWANDA - 2014-15 DHS\Plan1.csaplan'
  /TABLES VARIABLES=cigarettes
  /CELLS POPSIZE TABLEPCT
  /STATISTICS SE CIN(95)
  /MISSING SCOPE=TABLE CLASSMISSING=EXCLUDE.

** CROSSTAB CIGARETTES WITH AGE GROUP - from the output, your percentage is named "estimate" with the %

CSTABULATE
  /PLAN FILE='C:\Users\Dubile\Documents\RWANDA - 2014-15 DHS\Plan1.csaplan'
     /TABLES VARIABLES=MV013 BY cigarettes
  /CELLS POPSIZE ROWPCT
  /STATISTICS CIN(95)
  /MISSING SCOPE=TABLE CLASSMISSING=EXCLUDE.

/***************************************************************************************************************************/

 *** DERIVING VARIABLE = SMOKING PIPE

RECODE MV463B (1=1) (0=0) (9=0) (ELSE=0) INTO pipe.
VALUE LABELS pipe 0"No" 1"Yes".
VARIABLE LABELS  pipe 'Smokes pipe.'.
EXECUTE.

* CHECK IF CORRECT USING COMPLEX SURVEY FREQUENCIES (should be the same as in the report)

** TABLE

CSTABULATE
  /PLAN FILE='C:\Users\Dubile\Documents\RWANDA - 2014-15 DHS\Plan1.csaplan'
  /TABLES VARIABLES=pipe
  /CELLS POPSIZE TABLEPCT
  /STATISTICS SE CIN(95)
  /MISSING SCOPE=TABLE CLASSMISSING=EXCLUDE.

** CROSSTAB PIPE WITH AGE GROUP  - from the output, your percentage is named "estimate" with the %

CSTABULATE
  /PLAN FILE='C:\Users\Dubile\Documents\RWANDA - 2014-15 DHS\Plan1.csaplan'
  /TABLES VARIABLES=MV013 BY pipe
  /CELLS POPSIZE ROWPCT
  /STATISTICS CIN(95)
  /MISSING SCOPE=TABLE CLASSMISSING=EXCLUDE.

/***************************************************************************************************************************/

 *** DERIVING VARIABLE = OTHER TOBACCO

COMPUTE other_tobacco = 0.
if MV463C = 1  or MV463D  = 1 or MV463X  =  1  other_tobacco = 1.
if MV463C NE 1 and MV463D  NE 1 and MV463X  NE  1  other_tobacco = 0.
value labels other_tobacco 0 "No" 1 "Yes".
VARIABLE LABELS other_tobacco 'Uses/smokes other tobacco'.
EXECUTE.

* CHECK IF CORRECT USING COMPLEX SURVEY FREQUENCIES (should be the same as in the report)

** TABLE

CSTABULATE
  /PLAN FILE='C:\Users\Dubile\Documents\RWANDA - 2014-15 DHS\Plan1.csaplan'
  /TABLES VARIABLES=other_tobacco
  /CELLS POPSIZE TABLEPCT
  /STATISTICS SE CIN(95)
  /MISSING SCOPE=TABLE CLASSMISSING=EXCLUDE.

** CROSSTAB PIPE WITH AGE GROUP  - from the output, your percentage is named "estimate" with the %

CSTABULATE
  /PLAN FILE='C:\Users\Dubile\Documents\RWANDA - 2014-15 DHS\Plan1.csaplan'
  /TABLES VARIABLES=MV013 BY other_tobacco
  /CELLS POPSIZE ROWPCT
  /STATISTICS CIN(95)
  /MISSING SCOPE=TABLE CLASSMISSING=EXCLUDE.

** This part calculates the last three row of Table 3.8.2 **

CSTABULATE
  /PLAN FILE='C:\Users\Dubile\Documents\RWANDA - 2014-15 DHS\Plan1.csaplan'
  /TABLES VARIABLES=aged_50to59 BY other_tobacco
  /CELLS POPSIZE ROWPCT
  /STATISTICS CIN(95)
  /MISSING SCOPE=TABLE CLASSMISSING=EXCLUDE.

 *** DERIVING VARIABLE = DOES NOT USE/SMOKE TOBACCO

RECODE MV463Z (1=1) (0=0) (9=0) (ELSE=0) INTO does_not_use_tobacco.
VALUE LABELS does_not_use_tobacco 0"No" 1"Yes".
VARIABLE LABELS  does_not_use_tobacco 'Does not use/smoke tobacco products.'.
EXECUTE.

* CHECK IF CORRECT USING COMPLEX SURVEY FREQUENCIES (should be the same as in the report)

** TABLE

CSTABULATE
  /PLAN FILE='C:\Users\Dubile\Documents\RWANDA - 2014-15 DHS\Plan1.csaplan'
  /TABLES VARIABLES=does_not_use_tobacco
  /CELLS POPSIZE TABLEPCT
  /STATISTICS SE CIN(95)
  /MISSING SCOPE=TABLE CLASSMISSING=EXCLUDE.

** CROSSTAB PIPE WITH AGE GROUP  - from the output, your percentage is named "estimate" with the %

CSTABULATE
  /PLAN FILE='C:\Users\Dubile\Documents\RWANDA - 2014-15 DHS\Plan1.csaplan'
  /TABLES VARIABLES=MV013 BY does_not_use_tobacco
  /CELLS POPSIZE ROWPCT
  /STATISTICS CIN(95)
  /MISSING SCOPE=TABLE CLASSMISSING=EXCLUDE.

** This part calculates the last three row of Table 3.8.2 **

CSTABULATE
  /PLAN FILE='C:\Users\Dubile\Documents\RWANDA - 2014-15 DHS\Plan1.csaplan'
  /TABLES VARIABLES=aged_50to59 BY does_not_use_tobacco
  /CELLS POPSIZE ROWPCT
  /STATISTICS CIN(95)
  /MISSING SCOPE=TABLE CLASSMISSING=EXCLUDE.


save outfile 'C:\Users\Dubile\Desktop\MAPS\RWANDA_MEN_ANALYSIS.sav'.

**///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////**

** ANALYSIS FOR ONLY MEN AGED 15-49 YEARS

***** RESTRICT - (SELECT CASES)

USE ALL.
COMPUTE filter_$=(MV012 >= 15 & MV012 <= 49).
VARIABLE LABELS filter_$ 'MV012 >= 15 & MV012 <= 49 (FILTER)'.
VALUE LABELS filter_$ 0 'Not Selected' 1 'Selected'.
FORMATS filter_$ (f1.0).
FILTER BY filter_$.
EXECUTE.

*** CROSSTABS

CSTABULATE
  /PLAN FILE='C:\Users\Dubile\Documents\RWANDA - 2014-15 DHS\Plan1.csaplan'
  /TABLES VARIABLES=education BY cigarettes
  /CELLS POPSIZE ROWPCT
  /STATISTICS CIN(95)
  /MISSING SCOPE=TABLE CLASSMISSING=EXCLUDE.


CSTABULATE
  /PLAN FILE='C:\Users\Dubile\Documents\RWANDA - 2014-15 DHS\Plan1.csaplan'
  /TABLES VARIABLES=education BY pipe
  /CELLS POPSIZE ROWPCT
  /STATISTICS CIN(95)
  /MISSING SCOPE=TABLE CLASSMISSING=EXCLUDE.


CSTABULATE
  /PLAN FILE='C:\Users\Dubile\Documents\RWANDA - 2014-15 DHS\Plan1.csaplan'
  /TABLES VARIABLES=education BY other_tobacco
  /CELLS POPSIZE ROWPCT
  /STATISTICS CIN(95)
  /MISSING SCOPE=TABLE CLASSMISSING=EXCLUDE.

CSTABULATE
  /PLAN FILE='C:\Users\Dubile\Documents\RWANDA - 2014-15 DHS\Plan1.csaplan'
  /TABLES VARIABLES=education BY does_not_use_tobacco
  /CELLS POPSIZE ROWPCT
  /STATISTICS CIN(95)
  /MISSING SCOPE=TABLE CLASSMISSING=EXCLUDE.

 
Read Message
Read Message
Read Message
Read Message
Previous Topic: Datasets on Polygyny
Next Topic: Difference dataset household member recode and household recode
Goto Forum:
  


Current Time: Thu Apr 18 13:46:56 Coordinated Universal Time 2024