# Calculating Total using Compute function

In this section, we will learn how to calculate the **total score** using **Arithmetic operators** like plus, minus. If we look at the **Compute variable function**, we have a **Target Variable** list. In that case, we need to name our target variable. All of our existing variables are shown in the following diagram:

We will go to Transform, and then compute variable. We will choose our **Target Variable**, and then write **Numerical Expression** like plus or minus in the **Numerical Expression** box. We can take the help of the following **buttons** for writing our numerical expression.

These functions have been grouped here, and we can see the **Groping** and **details** of those available functions within a particular group in the following image. For the Arithmetic group, we can see Abs(absolute) and other functions. When we select the statistical function, we can see Max, Mean, Medium, etc.

Apart from that, there is an **if option** available here, and that we can use for doing some conditional computing. **For example**, suppose we want to calculate the total value of **males** or **females**. In that case, we can select our data accordingly. We are currently going to use a simple total function in which we want to calculate the total score for the given scale. So we will quickly understand this data set. The data set is about a personality scale and based on the existing theory of personality. There are many dimensions of personality. **For example**, one of the popular theories of personality is **Eysenckâ€™s personality theory**, in which he hypothesis that human personality varies on **two dimensions**. One shows **Stability Vs. Instability**. The vertical dimension is the dimension of **Instability Vs. Stability**.

In the above image, we can see **Neurotic** on the **top** and **Stable** on the **bottom** side. **Neurotic** are those people who are restless, highly unstable by nature. **Stable** personalities are those personalities who are even-tempered and very regular in their approach. Another dimension on the **X-axis** is **Introversion** Vs. **Extroversion**. So **Introverts** are basically shy reversed. **Extroversions** are more socially oriented. They prefer being popular and make a lot of friends. The scale we have taken here based on **Eysenckâ€™s personality theory**. We have total of 15 items. The items which are ending with **N** refer to the item belonging to the **Neuroticism** dimension. While **E** stands for **Extroversion**, **S** stands for **Stability**, and **I** stand for **Introversion**.

Before we do any analysis, for example, if we want to do a **t-test, anova** or **correlation**, or **regression**, we need to find the total score. The first total score on the **entire personality** scale and also the total score **dimension wise. For example**, how much a person is scoring on Neuroticism as compare to Stability or Introversion as compare to Extroversion. So for that, we need to simply calculate the **total**. For doing that, we can take the help of the **compute function**. So we will go to **Transform**, click on **Compute Variable**. Now we will see the following window:

Once we see this dialog box, we need to name the **Target variable**, and we are going to calculate the total **dimension** wise. Suppose first we will calculate the **total** on **Neuroticism**. So we will define **Neuroticism_Total** on **Target variable**. If we want to define the type and label of the variable, we can click the **Type & Label** option, as shown below:

When we click on this, we will see the following window, and we will define **Label** as **Total Score on Neuroticism**. Itâ€™s a Numeric variable, so will click on **Continue** like this:

The type and Label are defined. So letâ€™s start doing the total of **Neuroticism**. For simplicity, we will display the variable name by **right click** on the variable. After this, we will get the variables name as follows:

Now we will take the **first** variable, which belongs to the **Neuroticism dimension**, and clicks on the **arrow**. After that, the variable will be shifted under **Numeric Expression** then we will add the **plus**. We are using plus, but according to our requirements, we can add minus, division, and other functions. Currently, we are doing total, so we will use plus. Now we will add **third**, and thatâ€™s all. So we have just two items on **Neuroticism**. So we will click **Ok** like this:

In the following image, we can see that the **Neuroticism total score** has been generated, and the scale has been defined. We need to **refine** the **scale**. The software is defined as a **Nominal** variable, but it is not a Nominal variable. It is a scale variable. Because the sum two **scale** variables will be a scale variable. So we will change it as a Scale variable.

Similarly, we can find the total of all other scales like the **extroversion** scale, **introversion** scale, and **stability** scale. We can see in the **Data set** that a new variable **Neuroticism_Total** must be created, and that gives us total of Neuroticism dimension.

Similarly, we can create totals for the remaining three subscales. So we will go to **Transform** and then **compute variable**. This time, the total is for **Stability**, so we will write **Stability_Total** under the **Target variable**. We need to select the items, so we will choose **question no 4 + question no 5 + question no 15,** and then click **Ok**. Now we can see the **Stability_Total** has been created.

Now we will find the total of **Introversion**. So we will add Introversion_Total under the **Target variable**. We will select **question no 7 + question no 11 + question no 13**, and then click **Ok**. Now we can see the **Introversion_Total** has been created.

Now we will find the total of **Extroversion**. So we will add **Extroversion_Total** under the **Target variable**. We will select **question no 2 + question no 6 + question no 8 + question no 9 + question no 10 + question no 12 + question no 14**, and then click **Ok**. Now we can see the **Extroversion_Total** has been created.

In the above image, we can see that total of all **four scales** have been created. Now we will change the measure level for **Stability** and **Introversion** into **Scale** variable.