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-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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