Hi,
is anybody able to help me of how to write the following equation in SAS?
eGFRcr = 142 x min(Scr/κ, 1)α x max(Scr/κ, 1)-1.200 x 0.9938Age x 1.012 [if female]
where:
Scr = standardized serum creatinine in mg/dL
κ = 0.7 (females) or 0.9 (males)
α = -0.241 (female) or -0.302 (male)
min(Scr/κ, 1) is the minimum of Scr/κ or 1.0
max(Scr/κ, 1) is the maximum of Scr/κ or 1.0
Age (years)
Thanks in advance!
Hi @ursula,
With input data like this
data have;
input SCr age sex $;
cards;
0.82 65 M
0.93 71 F
;
you can compute eGFR according to your formula as follows
data want;
set have;
if n(SCr, age)=2 then do;
if sex='F' then eGFR=142*min(SCr/0.7,1)**-0.241*max(SCr/0.7,1)**-1.2*0.9938**age*1.012;
else if sex='M' then eGFR=142*min(SCr/0.9,1)**-0.302*max(SCr/0.9,1)**-1.2*0.9938**age;
end;
run;
and, if you like to get external confirmation, compare a few results to those of the online calculator https://www.kidney.org/professionals/kdoqi/gfr_calculator with
Hi @ursula,
With input data like this
data have;
input SCr age sex $;
cards;
0.82 65 M
0.93 71 F
;
you can compute eGFR according to your formula as follows
data want;
set have;
if n(SCr, age)=2 then do;
if sex='F' then eGFR=142*min(SCr/0.7,1)**-0.241*max(SCr/0.7,1)**-1.2*0.9938**age*1.012;
else if sex='M' then eGFR=142*min(SCr/0.9,1)**-0.302*max(SCr/0.9,1)**-1.2*0.9938**age;
end;
run;
and, if you like to get external confirmation, compare a few results to those of the online calculator https://www.kidney.org/professionals/kdoqi/gfr_calculator with
Thank you so much for your help!
I really appreciate for the prompt response!
Have a great weekend!
sorry , I have a tiny quick question about the code from you.
data want;
set have;
if n(SCr, age)=2 then do;
if sex='F' then eGFR=142*min(SCr/0.7,1)**-0.241*max(SCr/0.7,1)**-1.2*0.9938**age*1.012;
else if sex='M' then eGFR=142*min(SCr/0.9,1)**-0.302*max(SCr/0.9,1)**-1.2*0.9938**age;
end;
run;
what does the "n" ( if n(SCr, age) = 2 then do:) mean?
Thanks,
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.