BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
ursula
Pyrite | Level 9

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!

1 ACCEPTED SOLUTION

Accepted Solutions
FreelanceReinh
Jade | Level 19

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

  • Serum Cystatin C: left blank
  • Standardized Assays: Yes
  • Adjust for body surface area: No

View solution in original post

5 REPLIES 5
FreelanceReinh
Jade | Level 19

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

  • Serum Cystatin C: left blank
  • Standardized Assays: Yes
  • Adjust for body surface area: No
ursula
Pyrite | Level 9

Thank you so much for your help!

I really appreciate for the prompt response!

Have a great weekend!

ursula
Pyrite | Level 9

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,

ursula
Pyrite | Level 9
Thanks much! got it now !

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

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
  • 5 replies
  • 2253 views
  • 5 likes
  • 3 in conversation