Skip to content
Advertisement

Calculation using SQL server

Formula used This is the formula that I used to calculate
Expressed as a single equation:

eGFR = 142 x min(Scr/κ, 1)α x max(Scr/κ, 1)-1.200 x 0.9938Age x 1.012 [if female]

where:

Scr = serum creatinine in mg/dL
κ = 0.7  
α = -0.329  
min(Scr/κ, 1) is the minimum of Scr/κ or 1.0
max(Scr/κ, 1) is the maximum of Scr/κ or 1.0
Age (years)

Code that I tried

select 
   ROUND(141 * power(min(cast(40 as float) / 0.7 ) ,-0.329) * 
     power(max( cast(40 as float) / 0.7 * 1) ,- 1.209) * 0.993 *
     cast(42 as float) * 1.018 ,2) as kidney

Correct answer should be 123.

Any clue what I am missing in the query?

Advertisement

Answer

According to this site your equation is kinda wrong. Please be sure to add ^ to display the “to the power of”.

DECLARE @Scr    AS FLOAT       = 40.0;
DECLARE @gender AS VARCHAR(10) = 'female';
DECLARE @age    AS SMALLINT    = 42;
DECLARE @k      AS FLOAT       = CASE WHEN @gender = 'male' THEN 0.9    ELSE 0.7    END;
DECLARE @a      AS FLOAT       = CASE WHEN @gender = 'male' THEN -0.302 ELSE -0.241 END;
DECLARE @factor AS FLOAT       = CASE WHEN @gender = 'male' THEN 1.000  ELSE 1.012  END;

SELECT 142 * POWER(IIF(1 < (@Scr/@k), 1, @Scr/@k), @a)
           * POWER(IIF(1 > (@Scr/@k), 1, @Scr/@k), -1.200)
           * POWER(0.9938, @age)
           * @factor;

Also this result is correct since it is calculated in mg/dl and your expected value is in umol/l

Here is another website (it may be german, but it should do the trick)

User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement