Functions and CALL Routines |
Category: | Mathematical |
Syntax | |
Arguments | |
Details | |
Examples | |
See Also |
Syntax |
GCD(x1, x2, x3, ..., xn) |
specifies a numeric constant, variable, or expression that has an integer value.
Details |
The GCD (greatest common divisor) function returns the greatest common divisor of one or more integers. For example, the greatest common divisor for 30 and 42 is 6. The greatest common divisor is also called the highest common factor.
If any of the arguments are missing, then the returned value is a missing value.
Examples |
The following example returns the greatest common divisor of the integers 10 and 15.
data _null_; x=gcd(10, 15); put x=; run;
SAS writes the following output to the log:
x=5
See Also |
Functions: |
Copyright © 2011 by SAS Institute Inc., Cary, NC, USA. All rights reserved.