DATA Step, Macro, Functions and more

DEGREES and ARCOS functions in SAS

Reply
Contributor
Posts: 20

DEGREES and ARCOS functions in SAS

Hi All,

 

I am trying to calculate Angle by using Degrees(ARCOS) functions in SAS, But Data step getting an errror.Please advice 

 

26 Degrees=DEGREES(ARCOS(Theta/(Len_A+Len_B)));
_______
68
ERROR 68-185: The function DEGREES is unknown, or cannot be accessed.

Super User
Posts: 19,815

Re: DEGREES and ARCOS functions in SAS

What version of SAS do you have?
Contributor
Posts: 20

Re: DEGREES and ARCOS functions in SAS

I am on SAS 9.4_M1 and   SAS EG 6.1

Super User
Posts: 19,815

Re: DEGREES and ARCOS functions in SAS

I'm only finding documentation for the function under SAS 9.4 and in PROC FEDSQL. You may need to use a PROC FEDSQL statement to use this function.

The conversion from radians to degrees is fairly straightforward, you should be able to write a basic function or formula if you don't like using FEDSQL.
Respected Advisor
Posts: 4,925

Re: DEGREES and ARCOS functions in SAS

Define your own function, callable from data steps and SQL:

 

proc fcmp outlib=sasuser.fcmp.math;
function degrees(radians);
if missing(radians) then return(.);
r = mod(radians, 2*constant("PI"));
return (r*360/(2*constant("PI")));
endsub;
run;

options cmplib=sasuser.fcmp;

data _null_;
do x = -2 to 2 by 0.125;
    r = x*2*constant("PI");
    d = degrees(r);
    put r= d=;
    end;
run; 
PG
Ask a Question
Discussion stats
  • 4 replies
  • 310 views
  • 0 likes
  • 3 in conversation