Skip to main content

Compute variables using SPSS


Many often, people ask a question like, "I have two variables named height and weight in SPSS; how do I use the formula to find out a third variable named BMI for all the cases/observation?" Some people even perform calculations manually and find out the result for each observation. However, see the steps below to carry out the functions automatically using SPSS. This is possible by the use of "compute variable" feature of SPSS which is explained below:

Steps of using compute variable feature in SPSS:
1. First of all, open a data set where you have the desired variable which you want to use for performing compute feature. In this case, I entered the hypothetical height and weight of 9 cases.

2, After that, note the formula which is to be used to perform compute variable feature. Here, I want to calculate a new variable BMI by using the formula, BMI=weight_gram/(height_cm*height_cm)*100

3. Click on transform, compute variable
4. Then you see the following dialog box

5. In the target variable section, type the name of new variable you want to create. Similarly, in the numeric expression, type the formula by dragging the variables from the list to the right.
6. After that, you can also set the type and label of the target variable by clicking the "Type & label" button in the dialog box,
7. After that, you can click on continue and then ok, after that you will see that a new variable BMI is formed.
8. Now, we can do analysis of this new variable. For example, we can perform descriptive statistics by clicking on analyze, descriptive statistics and descriptives, we see the following dialog box, and place the variable BMI on the list of variable(s) and click on ok.
9. It will show the output showing the basic descriptive analysis.
Thus you can do calculations to form a new variable using the "compute variable" feature of SPSS. The following video explains the steps with the hypothetical example as stated in the steps above for BMI.

If you have any comments or queries, place a comment below. Share the tutorial so that others may too benefit. See you in the next tutorial.

Comments

Popular posts from this blog

Median test between 2 or more independent groups in SPSS

Multiple response analysis using SPSS

Creating date variable and calculating between two dates in SPSS