14.03.2014 Views

Scripting Guide - SAS

Scripting Guide - SAS

Scripting Guide - SAS

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Appendix A JSL Syntax Reference 557<br />

Arithmetic Functions<br />

Arithmetic Functions<br />

Here are the six essential arithmetic operators and their function equivalents. You can add numbers,<br />

matrices, and variables that contain either. Each operator has two forms: an operator (for example, +) and a<br />

functional equivalent (for example, Add()).<br />

Add(a, b, ...)<br />

a+b+...<br />

Description<br />

Adds the values of the listed arguments. No arguments are changed.<br />

Returns<br />

The sum.<br />

Arguments<br />

For Add(), a comma-separated list of variables, numbers, or matrices.<br />

For a+b, any number of variables, numbers, or matrices.<br />

Notes<br />

Any number of arguments is permitted. If no argument is specified, Add() returns 0.<br />

See Also<br />

The Data Structures chapter in the <strong>Scripting</strong> <strong>Guide</strong>.<br />

Divide(a, b)<br />

Divide(x)<br />

a/b<br />

Description<br />

Divides a by b. If only one argument is given (divide(x)), divides 1 by x.<br />

Returns<br />

The quotient of a/b; or the reciprocal of x (1/x) if only one argument is provided.<br />

Arguments<br />

a, b, x Can be a variable, number, or matrix.<br />

Notes<br />

If both arguments are matrices, it does matrix division.<br />

See Also<br />

The Data Structures chapter in the <strong>Scripting</strong> <strong>Guide</strong>.<br />

Minus(a)<br />

-a<br />

Description<br />

Reverses the sign of a.<br />

Returns<br />

-a if a is positive (a=3; -a=-3; Minus(a)=-3).

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!