**Arithmetic Operator**

In SAS, there are five arithmetic operators. Below is the chart detailing each of the five operators:

Let's look at an example.

```
Data Test;
a = 3**2;
Run;
```

In this example, the value **a** is equal to 3 raised to the power of 2, which is 9.

**Automatic Conversion**

Sometimes, for whatever reason, you may choose to store a numeric value in a character variable.

When performing mathematical operations on such character variables, SAS will automatically convert the character values to numeric values.

Let's look at an example.

```
Data Retail;
cost = '20000';
total = .10 * cost;
run;
```

In this example, the COST variable contains a character value '20000'.

When multiplying the character value by 0.1, SAS will automatically convert the character value to a numeric value.

The total will be calculated as 2000.

**✍️ Exam Tips**

When performing a mathematical operation on a character variable, SAS will automatically convert the character values to numeric values before the operation.

💯 **Sample Exam Question(s):**

Question 1

Question 2

Question 1:

The answer is (b).

The variable Z contains 3 raised to the power 2. The answer is 9.

----

Question 2:

The answer is (a).

SAS automatically converts the character value '20000' to a numeric value (20000) before multiplying the value by 0.1. The result is 2000.

Login

Accessing this course requires a login. Please enter your credentials below!