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,
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.