Hi all,
I have below derivation, can anyone help how can I implement this in sas?
Thanks,
Adithya
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?
Thanks,
Adithya
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;
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;
It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.
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.
Ready to level-up your skills? Choose your own adventure.