Mobile: 01822346868, 01673314980. Data Transformation - 2 Recoding Values We can modify the data values by recoding them, this is particularly useful for collapsing or combining categories, we can recode the values within existing variables, or we can create new variables based on the recoded values of existing. That is two types of recoding are possible. 1) Recode into same variable 2) Recode into different variable
Recode into same variable Recode into same variables reassigns the values of existing variables ranges of existing values into new values. For example, we can collapse Marks into Marks Range categories. We can recode numeric and string variables, but we can not recode numeric and string variables together. If we select multiple variables, they must be all of the same type. To recode values of a variable in to same variable we follow the following steps: a) From the menus choose:
Transform Recode Into same Variables
b) Select the variable which we want to recode. (If we select Multiple variables, they must all be of the same type, numeric or string). c) Click Old and New Values. d) We shall see the recode into Same Variables: Old and New Values dialog box.
We can define values to recode in this dialog box. All value specifications must be the same data type (numeric or string) as the variables selected in the main dialog box. The variable whose value is to be recoded is to be recoded is defined as old Value, but we can not recode one Old Value into more than one new value.
Illustrative Examples Example 6: Suppose we want to define Educational Status on the basis of year of schooling from the following data using the following specifications: Year of Schooling new value(code) meaning (value label) 0 =1 =Illiterate 1-5 =2 =Primary 6-10 =3 =Secondary 11-12 =4 =Higher Secondary 13-16 =5 =Graduate 17 =6 =Post Graduate 18+ =7 =Higher SPSS for Professionals, Researchers & Students
Md. Nurul Huda. Mobile: 01822346868, 01673314980.
Yearsch 15 6 7 20 14 11 8 10 13 5 0 12 18 16
Now, to recode this data into new values, we follow the following steps: a) From the menus choose:
Transform Recode Into same variables.. This will open the Recode into Some Variable dialog box. Select yearsch from the variable list (lift window) and then click the arrow on the vertical bar of the dialog box with the left mouse. b) Then we click on Old and New Values option. c) We shall see the Recode into Variables: Old and New Values dialog box. d) Using the Old value and new value options we recode the variable in our desired format. e) Click left mouse button to continue box to return the Recode Into same Variable dialog box. f) Click OK.
We shall see that to define the variable yearsch has automatically been recoded on the existing variable.
Example:7
Suppose we want to define the Social Status on the basis of income Variable given below using the following specifications: Income (Monthly) New value(code) meaning (value label)
Less than 3000 =1 =Lower Class 3001-10000 =2 =Lower Middle 10001-25000 =3 =Middle Class 25001-100000 =4 =Higher Middle Class 100001+ =5 =Higher Class Income 20000 22000 1800 900 35000 7000 56000 32000 SPSS for Professionals, Researchers & Students
Now, to recode this data into new values, we follow the following steps: a) From the menus choose:
Transform Recode Into same variables.. This will open the recode into Same variable dialog box b) Select income from the variable list (list Window) and then click the arrow on the vertical bar of the dialog box with the left mouse. c) Then we click on Old and New values option. d) We shall see the recode into Same Variables: Old and New Values dialog box. e) Using the old value and new value options we recode the variable in our desired format. f) Click left mouse button to Continue box to return the Recode into Same Variable dialog box. g) Click OK.
We shall see that the variable income has automatically been recoded on the existing variables or collapses ranges of existing values into new values for recode into Different Variables Recode into Different Variables the values of existing variables or collapses ranges of existing values into new values for a new variable. For example, we can collapse marks into a new variable containing Marks-Range categories. We can recode numeric and string variables, but we can not recode numeric and strain variables together. If we select multiple variables, they must be all of the same type. Also we can recode numeric variables into string variables and string variables into numeric variables.
To recode values of a variable into different variable we follow the following steps: a) From the menus choose: Transform Recode Into Different Variables b) Select the variable which we want to recode. (If we select multiple variables, they must all be of the same type, numeric or string). c) Enter an output (new) variable and name for each new variable and click Change. d) Click Old and new values and specify how to recode values.
We can define values to recode in the Old and New value dialog box. All value specifications must be the same data type (numeric or string ) We can recode more than one Old Values to one New Value, but we can not recode one Old Value into more then one new value.
In we want to recode a numeric variable into a string variable, you must also select Output variables are strings. SPSS for Professionals, Researchers & Students
Md. Nurul Huda. Mobile: 01822346868, 01673314980.
Any old values that are not specified are not included in the new variable, and cases with those values will be assigned, select all Other Values for the old value and Copy old value(s) for the new value.
Example: 8 Suppose we want to define the Social Status on the basis of Income Variables given below using the following specifications:
Income (Monthly) New value(code) meaning (value label)
Less than 3000 =1 =Lower Class 3001-10000 =2 =Lower Middle 10001-25000 =3 =Middle Class 25001-100000 =4 =Higher Middle Class 100001+ =5 =Higher Class Income 20000 22000 1800 900 35000 7000 56000 32000 3200 125000 17000 45000 78000 245000
Now, to recode this data into new values, we follow the following steps: a) From the menus choose: Transform Recode Into same variables This will open the Recode into Same Variable dialog box. b) Select income from the variable list (list window) and then click the arrow on the vertical bar of the dialog box with the left mouse. c) We shall see the variable income in the Numeric variables Output variable box. d) Write the name of new variable i.e. income on Output variable Name box. e) Now label the new variable using the Output variable dialog box. f) Click on Change option. g) Then we click on Old and New Values option. h) We shall see the Recode Into Different Variables: Old and New Values dialog box. i) Using the Old values and New value options we recode the variable in our desired format. j) Click left mouse button to Continue box to return the Recode Into same Variable dialog box. k) Click Ok.
SPSS for Professionals, Researchers & Students
Md. Nurul Huda. Mobile: 01822346868, 01673314980. Example 9: Suppose we want to define Educational Status on the basis of year of schooling from the following data using the following specifications: Year of Schooling new value(code) meaning (value label) 0 =1 =Illiterate 1-5 =2 =Primary 6-10 =3 =Secondary 11-12 =4 =Higher Secondary 13-16 =5 =Graduate 17 =6 =Post Graduate 18+ =7 =Higher
Yearsch 15 6 7 20 14 11 8 10 13 5 0 12 18 16
Now, to recode this data into new values, we follow the following steps: g) From the menus choose:
Transform Recode Into different variables.. This will open the Recode into Some Variable dialog box.
b). Select yearsch from the variable list (lift window) and then click the arrow on the vertical bar of the dialog box with the left mouse. c). We shall see the variable yearsch ? In the Numeric variables Output variable box. d). Write the name of new variable i.e. scstatus on Output variable box. e). Now label the new variable using the Output variable Label: box. f). Click on change option.
g). Then we click on Old and New Values option. h) We shall see the Recode into Variables: Old and New Values dialog box. i) Using the Old value and new value options we recode the variable in our desired format. j) Click left mouse button to Continue box to return the Recode Into same Variable dialog box. k) Click OK.