Calculating with Numeric Variables

Using Arithmetic Operators in Assignment Statements

One way to perform calculations on numeric variables is to write an assignment statement using arithmetic operators. Arithmetic operators indicate addition, subtraction, multiplication, division, and exponentiation (raising to a power). For more information about arithmetic expressions, see the discussion in SAS Language Reference: Concepts.
The following table shows operators that you can use in arithmetic expressions.
Table 8.1 Operators in Arithmetic Expressions
Operation
Symbol
Example
addition
+
x = y + z;
subtraction
x = y - z;
multiplication
*
x = y * z
division
/
x = y / z
exponentiation ...

Get Step-by-Step Programming with Base SAS 9.4 now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.