BookmarkSubscribeRSS Feed
Andre_AA1
Calcite | Level 5

Hi, 

 

Is there a way to operate with symbols (variables x, y, etc) on SAS? Like 2x+3x=5x or exp(2*3+1-x/2)=exp(7-0.5*x) ?

 

I searched for it online and couldnt find anything. And I think it's kind of a long shot, because SAS is more for data analysis, but since some mathematical softwares do it, I thought I'd ask.

9 REPLIES 9
LinusH
Tourmaline | Level 20

Sure, I mean, symbols are implemented as variables in SAS, and the formulas you provide can be coded in the data step, SQL to name a few places.

Can you give a bit more context how you wish to use this?

Data never sleeps
Andre_AA1
Calcite | Level 5

I constructed a model (logistic regression) with 12 explanatory variables, so I have the model function y = f(x_1, x_2, ..., x_12). Besides, I have another function that depends on one of this variables, say z=g(x_1). Now, I need tho solve the equation for x_1:

 

f(x_1,...,x_12)*g(x_1)=Lambda,

 

where Lambda is some constant.

 

As I was writing this reply, I realized it is more than I asked in the original question, but the operating with symbols seemed a good place to start and I didn't find anything online.

Reeza
Super User
Seems like you want to look into PROC NLIN?
Andre_AA1
Calcite | Level 5

Isn't this for modelling with nonlinear types of equation? I read some of the documentation and didn't find it related... I wanted the "pure" mathematical expression thats solves the equation.

Reeza
Super User
Then AFAIK, SAS does not do this.
ballardw
Super User

You may need to clarify what you mean by your question.

Do you mean if a SAS data set variable contains such calculations can it be used to perform the calculations?

Or do you mean to manipulate the text of a value to a different equivalent form?

Where are these operations stored?

 

 

Reeza
Super User
AFAIK SAS does not simplify mathematical equations, which is my interpretation of your question.
Ksharp
Super User
Maybe @Rick_SAS knows ?
Rick_SAS
SAS Super FREQ

In general, it is impossible to solve the equation  f(x_1,...,x_12)*g(x_1)=Lambda for x_1. Symbolic math software (such as Mathematica or the free version at  WolframAlpha.com)  can invert simple equations such as low-order polynomials, and I think that is what you are asking about. No, SAS does not contain a symbolic algebra system.

 

However, for any specified value of Lambda, you can NUMERICALLY solve for the value of x_1 that satisfies the equation by finding the root (zero) of the equation  f(x_1,...,x_12)*g(x_1) - Lambda = 0. This is a one-dimensional root-finding problem, so can be solved in many ways. See 

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
SAS Enterprise Guide vs. SAS Studio

What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.

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
  • 9 replies
  • 713 views
  • 1 like
  • 6 in conversation