mics data processing workshop recoding in spss. secondary data processing flow export data from...

16
MICS Data Processing Workshop Recoding in SPSS

Upload: emily-brown

Post on 27-Mar-2015

213 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: MICS Data Processing Workshop Recoding in SPSS. Secondary Data Processing Flow Export Data from CSPRO Import Data into SPSS Recode Variables Add Sample

MICS Data Processing Workshop

Recoding in SPSS

Page 2: MICS Data Processing Workshop Recoding in SPSS. Secondary Data Processing Flow Export Data from CSPRO Import Data into SPSS Recode Variables Add Sample

Secondary Data Processing Flow

Export Data from CSPRO

Import Data into SPSS

Recode Variables

Add Sample Weights, Wealth Index and GPS Data

Run Tables

Page 3: MICS Data Processing Workshop Recoding in SPSS. Secondary Data Processing Flow Export Data from CSPRO Import Data into SPSS Recode Variables Add Sample

SPSS Working Directory

Right-click on SPSS icon Select Properties Click on Start-in box Type in C:\RECODING

Page 4: MICS Data Processing Workshop Recoding in SPSS. Secondary Data Processing Flow Export Data from CSPRO Import Data into SPSS Recode Variables Add Sample

Analysis Files

4 types of analysis files\cases– Households– Household members– Women– Children

Page 5: MICS Data Processing Workshop Recoding in SPSS. Secondary Data Processing Flow Export Data from CSPRO Import Data into SPSS Recode Variables Add Sample

Program Names

MAKEWM– Creates women’s analysis file

MAKECH– Creates children’s analysis file

Page 6: MICS Data Processing Workshop Recoding in SPSS. Secondary Data Processing Flow Export Data from CSPRO Import Data into SPSS Recode Variables Add Sample

Program Functions

Programs add needed variables 2 sources of new variables

– Existing variables that are recoded Age age in 5-year groups

– Combinations of existing variables Level and grade of education years of education

Page 7: MICS Data Processing Workshop Recoding in SPSS. Secondary Data Processing Flow Export Data from CSPRO Import Data into SPSS Recode Variables Add Sample

Recoding Variables

Some variables recoded in MAKE**.SPS– Important variables (e.g., age)– Frequently used variables

Some variables are recoded in tab programs– Variables used in only a few tables– Unusual recoding of a variable

Page 8: MICS Data Processing Workshop Recoding in SPSS. Secondary Data Processing Flow Export Data from CSPRO Import Data into SPSS Recode Variables Add Sample

Opening and Saving Files

To open a data fileget file = ‘filename.sav’.

To save a data filesave outfile = ‘filename.sav’.

Page 9: MICS Data Processing Workshop Recoding in SPSS. Secondary Data Processing Flow Export Data from CSPRO Import Data into SPSS Recode Variables Add Sample

The recode Command

To recode a variablerecode HL5 (lo thru 70 = copy)

(71 thru 96 = 70)

(98,99 = 99) into memage. Useful keywords

– lo and hi– copy– sysmis– else

Page 10: MICS Data Processing Workshop Recoding in SPSS. Secondary Data Processing Flow Export Data from CSPRO Import Data into SPSS Recode Variables Add Sample

The compute command

Creates a new variable– compute newvar = 1.

The compute command has built-in functions– compute newvar = trunc(oldvar).– compute newvar = rnd(oldvar).

Page 11: MICS Data Processing Workshop Recoding in SPSS. Secondary Data Processing Flow Export Data from CSPRO Import Data into SPSS Recode Variables Add Sample

Defining Variable and Value Labels

To define a variable labelvariable label memage "Age".

To define a value label setvalue label memage

70 ”70+" 99 ”Missing/DK“.

Defines value labels for unusual values Values 0-70 will be labeled using their actual value

Page 12: MICS Data Processing Workshop Recoding in SPSS. Secondary Data Processing Flow Export Data from CSPRO Import Data into SPSS Recode Variables Add Sample

The if Command

compute fuelelec = 0.if (hc6 = 1) fuelelec = 1.variable label fuelelec 'Household fuel type:

electricity'.value label fuelelec 0 'No' 1 'Yes'.

Page 13: MICS Data Processing Workshop Recoding in SPSS. Secondary Data Processing Flow Export Data from CSPRO Import Data into SPSS Recode Variables Add Sample

The do if Command

*total children ever born.

do if (CM1 = 1).

compute ceb = CM9.

else.

compute ceb = 0.

end if.

Page 14: MICS Data Processing Workshop Recoding in SPSS. Secondary Data Processing Flow Export Data from CSPRO Import Data into SPSS Recode Variables Add Sample

Selecting Cases to Process

The select commandselect if (HL5 >= 5 and HL5 <= 14).

Deletes unselected cases from memory

The filter commandfilter by CM9.

filter off. Selects cases for whom filter variable > 0 Unselected cases are ignored by subsequent commands

Page 15: MICS Data Processing Workshop Recoding in SPSS. Secondary Data Processing Flow Export Data from CSPRO Import Data into SPSS Recode Variables Add Sample

Other Useful Commands

To set a variable’s formatformat memage(f5.0).

To define missing valuesmissing values wdob (9999).

To count occurrences of a valuecount ways = v1 v2 v3 (1).

Page 16: MICS Data Processing Workshop Recoding in SPSS. Secondary Data Processing Flow Export Data from CSPRO Import Data into SPSS Recode Variables Add Sample

Using the Paste Option to Write Code

Set up the command using SPSS’s menu system

Click on the “Paste” button SPSS will “paste” the code necessary to

execute the command in the active syntax window

This is a great way to learn SPSS’s language