BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
ursula
Pyrite | Level 9

Hi,

Anyone can help me of how to code the below equation into SAS:

 

ursula_0-1681156658111.png

 

another one is (1e-6), how to code it in SAS?

 

Thanks in advance.

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
FreelanceReinh
Jade | Level 19

Hi @ursula,

 

You can also use the LOGISTIC function to make the code shorter:

FAST=logistic(-1.65+...);

View solution in original post

4 REPLIES 4
Reeza
Super User

EXP function for the e

** is power operator so for 2^3 you can do 2**3

 


@ursula wrote:

Hi,

Anyone can help me of how to code the below equation into SAS:

 

ursula_0-1681156658111.png

 

another one is (1e-6), how to code it in SAS?

 

Thanks in advance.

 

 


 

ballardw
Super User

The 1E-6 is easy in SAS: That is acceptable as a fixed value though there might sometimes be some issues related to storage precision. The FORMAT you use to display the value might be of interest.

 

data example;
   file print;
   x=1E-6;
   put 'Best5. format' x= best5.;
   put '9.7 format '   x= 9.7;
run;

 

Since you have the same long exponent in the numerator and denominator I would suggest calculating that as another variable and have much simpler code to type like

FAST = exp(thatvar)/ (1+Exp(thatvar));

s_lassen
Meteorite | Level 14

The formula can be calculated in a single step, but as the same complex expression occurs twice, it is faster to calculate it in two steps:

FAST=exp(-1.65+1.07*log(LSM)+2.66E-8*CAP**3-63.3/AST);                                                                                
FAST=FAST/(1+FAST);                                                                                                                   

- by "faster" I mean both the amount of typing to be done, and the CPU time for the calculation.

FreelanceReinh
Jade | Level 19

Hi @ursula,

 

You can also use the LOGISTIC function to make the code shorter:

FAST=logistic(-1.65+...);

SAS Innovate 2025: Register Now

Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
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.

SAS Training: Just a Click Away

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

Browse our catalog!

Discussion stats
  • 4 replies
  • 1098 views
  • 11 likes
  • 5 in conversation