Download presentation
Presentation is loading. Please wait.
Published byEmily Brown Modified over 11 years ago
1
MICS Data Processing Workshop Recoding in SPSS
2
Secondary Data Processing Flow Export Data from CSPRO Import Data into SPSS Recode Variables Add Sample Weights, Wealth Index and GPS Data Run Tables
3
SPSS Working Directory Right-click on SPSS icon Select Properties Click on Start-in box Type in C:\RECODING
4
Analysis Files 4 types of analysis files\cases – Households – Household members – Women – Children
5
Program Names MAKEWM – Creates womens analysis file MAKECH – Creates childrens analysis file
6
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
7
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
8
Opening and Saving Files To open a data file get file = filename.sav. To save a data file save outfile = filename.sav.
9
The recode Command To recode a variable recode HL5 (lo thru 70 = copy) (71 thru 96 = 70) (98,99 = 99) into memage. Useful keywords – lo and hi – copy – sysmis – else
10
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).
11
Defining Variable and Value Labels To define a variable label variable label memage "Age". To define a value label set value label memage 70 70+" 99 Missing/DK. Defines value labels for unusual values Values 0-70 will be labeled using their actual value
12
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'.
13
The do if Command *total children ever born. do if (CM1 = 1). compute ceb = CM9. else. compute ceb = 0. end if.
14
Selecting Cases to Process The select command select if (HL5 >= 5 and HL5 <= 14). Deletes unselected cases from memory The filter command filter by CM9. filter off. Selects cases for whom filter variable > 0 Unselected cases are ignored by subsequent commands
15
Other Useful Commands To set a variables format format memage(f5.0). To define missing values missing values wdob (9999). To count occurrences of a value count ways = v1 v2 v3 (1).
16
Using the Paste Option to Write Code Set up the command using SPSSs 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 SPSSs language
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.