## Mathematical Functions

The following is a brief summary of SAS functions useful for
defining models. Additional functions and details are in *SAS
Language: Reference*. Information on creating new functions can be found
in *SAS/TOOLKIT Software: Usage and Reference*,
chapter 15, "Writing a SAS Function or Call Routine."
- ABS(
*x*)
- the absolute value of
*x*

- ARCOS(
*x*)
- the arccosine in radians of
*x*. *x* should be
between -1 and 1.

- ARSIN(
*x*)
- the arcsine in radians of
*x*. *x* should be
between -1 and 1.

- ATAN(
*x*)
- the arctangent in radians of
*x*

- COS(
*x*)
- the cosine of
*x*. *x* is in radians.

- COSH(
*x*)
- the hyperbolic cosine of
*x*

- EXP(
*x*)
- e
^{x}

- LOG(
*x*)
- the natural logarithm of
*x*

- LOG10(
*x*)
- the log base ten of
*x*

- LOG2(
*x*)
- the log base two of
*x*

- SIN(
*x*)
- the sine of
*x*. *x* is in radians.

- SINH(
*x*)
- the hyperbolic sine of
*x*

- SQRT(
*x*)
- the square root of
*x*

- TAN(
*x*)
- the tangent of
*x*. *x* is in radians and is
not an odd multiple of .

- TANH(
*x*)
- the hyperbolic tangent of
*x*

*Random-Number Functions*

The MODEL procedure provides several functions for generating random numbers
for Monte Carlo simulation.
These functions use the same generators as the corresponding SAS DATA step
functions.
The following random-number functions are supported:
RANBIN, RANCAU, RANEXP, RANGAM, RANNOR,
RANPOI, RANTBL, RANTRI, and RANUNI.
For more information, refer to *SAS Language: Reference*.

Each reference to a random-number function sets up a separate
pseudo-random sequence.
Note that this means that two calls to the same
random function with the same seed produce identical results.
This is different from the behavior of the random-number functions
used in the SAS DATA step.
For example, the statements

x=rannor(123);
y=rannor(123);
z=rannor(567);

produce identical values for X and Y, but Z is from an independent
pseudo-random sequence.

For FIT tasks, all random-number functions always return 0.
For SOLVE tasks, when Monte Carlo simulation is requested,
a random-number function computes a new random number on the first iteration
for an observation (if it is executed on that iteration) and returns that
same value for all later iterations of that observation.
When Monte Carlo simulation is not requested, random-number
functions always return 0.

Copyright © 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.