LCM Function

Returns the least common multiple.

Category: Mathematical

Syntax

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

Required Argument

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.

Example

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: