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

Post on 27-Mar-2015

214 Views

Category:

Documents

0 Downloads

Preview:

Click to see full reader

TRANSCRIPT

MICS Data Processing Workshop

Recoding in SPSS

Secondary Data Processing Flow

Export Data from CSPRO

Import Data into SPSS

Recode Variables

Add Sample Weights, Wealth Index and GPS Data

Run Tables

SPSS Working Directory

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

Analysis Files

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

Program Names

MAKEWM– Creates women’s analysis file

MAKECH– Creates children’s analysis file

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

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

Opening and Saving Files

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

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

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

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).

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

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'.

The do if Command

*total children ever born.

do if (CM1 = 1).

compute ceb = CM9.

else.

compute ceb = 0.

end if.

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

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).

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

top related