BookmarkSubscribeRSS Feed
chinna0369
Pyrite | Level 9

Hi all, 

 

I have below derivation, can anyone help how can I implement this in sas?

 

anyalamadugu_0-1633712952090.png

 

Thanks,

Adithya

3 REPLIES 3
Reeza
Super User

Depends on your data set up to some degree. 

Assuming you have a data set with SCR, AGE and SEX as variables. 

 

if sex='Female' then eGFR = 194
                                                *(SCR**(1.094))
                                                 *(AGE**(-0.287))
                                                 *0.739;
else if sex = 'Male' then eGFR = 194
                                                *(SCR**(1.094))
                                                 *(AGE**(-0.287));

@chinna0369 wrote:

Hi all, 

 

I have below derivation, can anyone help how can I implement this in sas?

 

anyalamadugu_0-1633712952090.png

 

Thanks,

Adithya




 

 

ballardw
Super User

I don't see a square root anywhere much less a negative one.

 

In SAS you use the ** operator to exponentiate a value:

data example;
    x= 123;
   /* calculate x squared*/
    y= x**2;
    /* x to the minus 0.287 power*/
    z= x**(-0.287);
run;
Sajid01
Meteorite | Level 14

Hello @chinna0369 
I would like to point that negative numbers have no real square root. 

Incidentally in solving your equation there is no need to calculate a square root.

There are many approaches to solve your equations, I would prefer the following.

I am first creating a user defined function. This function can be used like any other function.

Then I have shown an example usage.

/* Creating function*/
proc fcmp outlib=work.userfuncs.mymath;
function egfr(gender, scr,age);
term1=194*input(&scr.,best12.)**(-1.094) *input(&Age.,best12.)**(-0.287);
if(upcase("&gender") eq "MALE")then factor=1;
 else factor=0.739;;
return (factor*term1);
endsub;
/* Example usage*/
options cmplib=work.userfuncs; data _null_; Gender=female; scr=100; age=50; egfr=egfr(gender,scr,age); put egfr=; run;

sas-innovate-2026-white.png



April 27 – 30 | Gaylord Texan | Grapevine, Texas

Registration is open

Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—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
  • 3 replies
  • 1175 views
  • 4 likes
  • 4 in conversation