Return to Archive SAS Tip of the Month February 2007 This month is a quick look at the trigonometric functions available in SAS. Function Trigonometric Inverse Hyperbolic -------------------------------------------- Sine SIN ARSIN SINH Cosine COS ARCOS COSH Tangent TAN ATAN TANH Note that all angles that are entered using the trigonometric functions are in radians, i.e. if the angle is in degrees then this value must be multiplied by PI/180 before using the function. The following example demonstrates the use of the SIN function and returning its inverse: data _null_; pi=constant('PI'); angle=30*PI/180; sinx=sin(angle); arsinx=arsin(sinx)*180/pi; put angle= sinx= arsinx= pi=; run; produces the output in the log angle=0.5235987756 sinx=0.5 arsinx=30 pi=3.1415926536 Note the use of the CONSTANT function - this function accesses certain mathematical constants, including PI, that are set within SAS. Before SAS version 8 the constant for PI did not exist so alternates were used to set a value for PI, namely setting PI to a value say 3.14159, or if more accuracy was needed setting the value to the result of ARCOS(-1). ________________________________ Updated February 11, 2007