BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
DatNinjaTurtle
Calcite | Level 5

 

 call symput('theta',arcos(Variable1));

I was trying to compute the arcos of Variable1, whose value is  much greater than 1. 

 

Obviously, any value gt 1 is not a valid input argument for the function arcos() . I wonder if there is any clever way to bypass the restriction?

 

While on the subject, can I assign complex value to a variable in SAS?

 

1 ACCEPTED SOLUTION

Accepted Solutions
Rick_SAS
SAS Super FREQ

SAS does not have built-in support for complex-valued analysis. There are a few instances where complex number arise in statistics (mostly time series and eigenvalues) but most SAS functions take real arguments. If you want to use complex values, you might want to consider symbolic math software such as Mathematica.

 

You can, of course, do these computations in SAS by defining your own functions, but it will be a pain. You can define the trig, arc-trig, and hyperbolic trig functions for complex numbers, but they are complicated and multivalued. You have to choose Principal Values to get an actual function.

View solution in original post

4 REPLIES 4
ChrisNZ
Tourmaline | Level 20

What do you mean bypass? What do you want arcos(2) to be?

 

As for complex numbers, SAS/IML is used. Lots of material if you do a web search like sas complex number

DatNinjaTurtle
Calcite | Level 5
I was hoping to get complex output. like arccos(2)=0.0000 + 1.3170i.
ChrisNZ
Tourmaline | Level 20

I see. My maths are too old...

Maybe @Rick_SAS would be able to help?

Rick_SAS
SAS Super FREQ

SAS does not have built-in support for complex-valued analysis. There are a few instances where complex number arise in statistics (mostly time series and eigenvalues) but most SAS functions take real arguments. If you want to use complex values, you might want to consider symbolic math software such as Mathematica.

 

You can, of course, do these computations in SAS by defining your own functions, but it will be a pain. You can define the trig, arc-trig, and hyperbolic trig functions for complex numbers, but they are complicated and multivalued. You have to choose Principal Values to get an actual function.

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 4 replies
  • 1371 views
  • 0 likes
  • 3 in conversation