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;

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!
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
  • 3 replies
  • 586 views
  • 4 likes
  • 4 in conversation