LESSON THREE

DATA TRANSFORMATIONS

In this lesson, we will learn how to compute and record new values.

I. Compute New Values

 A researcher had collected the data about family income and family size.

 

 Task: Compute income per capita.

 SPSS for Windows

 Create a new variable for income per capita, IPC.  

Compute income per capita: income / family size

A. Open a new Data Editor Window: File / New / Data. Enter data values.

B. Define the variable names: Click the Variable View tab. Enter the variable names: income and famsize.
 

 

C. To compute values for a new variable 'ipc', from the menus choose: Transform / Compute.
 

  

a. Click inside of the Target Variable text box. Enter the new variable name `ipc`.

b. Type “income” or move the variable ‘income’ to the Numeric Expression box. (Click the variable `income`. Click the > pushbutton. The variable `income` will appear in the Numeric Expression box.)

c. Type “/” or click the sign `/` (divide) from the calculator pad. The sign `/` will appear in the Numeric Expression box.

d. Click the variable `famsize`. Click the > pushbutton. The variable `famsize` will appear in the Numeric Expression box.

e. Click on OK. The data editor window displays the new variable `ipc` and its values. Print it out.

II. Recoding New Values

The data you had entered can be redefined using the RECODE procedure.

Example: Twenty-one parents in the X school district were randomly selected and asked how many years of formal education they have completed. Suppose you had information on education that ranged from 0 to 22 years, and now you need to do an analysis using only three categories: parents who did not complete high school, those who completed high school but not college, and those who completed college.

SPSS for Windows

A. Open a New Data window: File / New / Data

B. Define the variable `educ`. Enter 21 values.

C. From the menus choose: Transform / Recode / Into Same Variables

         a. Select `educ` and move it to the Numeric Variables list.

         b. To define the values (or ranges) to be recoded, click on Old and New Values.

D. Specify the old and new value or range.

  

a. Old Value Area

Specify the first old range. Click on the Range radio button as shown above. Enter the range: 0 through 11 for parents who did not complete high school.

b. New Value

Enter the new value: 1.

c. Click on Add. The numbers 0 through 11 will now be recorded as `1`.

d. Specify the second old range (12 through 15) and specify the second new value `2`. Click on Add. For those who completed high school but not college

e. Specify the third old range (16 through 22) and specify the third new value `3`. Click on Add. For those who completed college

E. Click on Continue. Return to the Recode into Same Variables dialog box. Click on OK. The existing variable `educ` will have a range of from 1 to 3 instead of from 0 to 22.

F. Produce a pie chart

a. To obtain pie charts, from the menus choose: Graphs / Pie

b. There is one category variable `educ` with three groups.

(a) Data in Chart Are

Summaries for groups of cases

(b) Click on Define.

c. A chart definition dialog will appear.

Click on the variable `educ` and move it to the Define Slices by text box.

Slice Represent: Click on % of cases.

Click on Titles. Enter your preferred text for the title of the pie chart.

Click Continue. Click OK.

G. Modify the chart

a. Double-click on the bar chart to bring up the Chart Editor window.

b. From the Chart Editor menu bar choose: Chart / Options

(a) Labels. Click on Percents. Display the percentage of the whole pie that each slice represents.

(b) Click on Edit Text. `1` is highlighted in the list. Delete `1` in the Label text box. Type `0 through 11` in the Label text box. Click on Change.

(c) Highlight `2` from the scroll list. Type `12 through 15` in the Label text box. Click on Change.

(d) Highlight `3` from the scroll list. Type `16 through 22` in the Label text box. Click on Change.

(e) Click Continue. Click OK.

Note that about 52% of the respondents did not complete high school. 

  

III. Recode New Values and Compute the Sum

Five subjects responded to three questions pertaining to attitude toward bilingual education with agree-disagree response categories. Assign 1 as agree and 0 as disagree. Compute a total score for each subject. Persons with higher scores have positive attitude toward bilingual education.

Item 1  Persons of Hispanic origin have a valid fear that American society is trying to rob them of the cultural background.

Item 2  The fundamental error in the conduct of the United States is the blind worship of a single language, erroneously regarded as the only possible foundation for its continued existence.

*Item 3  To give a person differential treatment, using his or her ethnic group membership as a criterion, is racism.

* Note that item 3 is worded negatively and the rating direction must change.

1. Recode New values

A. Open a new Data Editor window and enter the following data.

B. From the menus choose: Transform / Recode / Into Same Variables

a. Select `item3` and move it to the Numeric Variables list.

b. To define the values (or ranges) to be recoded, click on Old and New Values.

C. Specify the old and new values.

a. Old Value

Type 1 in the Value text box.

b. New Value

Click on the Value text box. Enter the new value: 0.

c. Click on Add as shown below.

 

d. Specify the second old value `0` and specify the second new value `1`. Click on Add.

D. Click Continue. Click OK. The variable “item 3” is now scaled in the appropriate direction. We are ready to compute a total scale

2. Compute the total score

A. To compute values for a new variable “total”, from the menus choose: Transform / Compute

a. Click on the Target Variable text box. Enter the new variable name `total`.

b. Next, scroll through the function list and select SUM[numexpr,numexpr,...] as shown below

c. Click the up arrow next to Function to enter the function to the Numeric Expression text box.

d. Type item1 to item3 and delete ?, ? as shown below

You may also type the numeric Expression shown above directly in the Numeric Expression text box.

e. Click OK. The data editor window displays the new variable `total` and its values.