Previous Page | Next Page

Functions and CALL Routines

LCM Function



Returns the least common multiple.
Category: Mathematical

Syntax
Arguments
Details
Examples
See Also

Syntax

LCM(x1, x2, x3, ..., xn)


Arguments

x

specifies a numeric constant, variable, or expression that has an integer value.


Details

The LCM (least common multiple) function returns the smallest multiple that is exactly divisible by every member of a set of numbers. For example, the least common multiple of 12 and 18 is 36.

If any of the arguments are missing, then the returned value is a missing value.


Examples

The following example returns the smallest multiple that is exactly divisible by the integers 10 and 15.

data _null_;
   x=lcm(10,15);
   put x=;
run;

SAS writes the following output to the log:

x=30


See Also

Functions:

GCD Function

Previous Page | Next Page | Top of Page