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.
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 the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.