Mathematical Functions

The following is a brief summary of SAS functions that are useful for defining models. Additional functions and details are in SAS Language: Reference. Information about creating new functions can be found in SAS/BASE Software: Procedure Reference, Chapter 18, The FCMP Procedure.

ABS(x )

the absolute value of x


the arccosine in radians of x; x should be between ${-1}$ and ${1}$.


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$^{\mi {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 ${{\pi }/2}$.

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, RAND, 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 following statements produce identical values for X and Y, but Z is from an independent pseudo-random sequence:

   q=rand('BETA', 1, 12 );

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.