Skip to main content

Posts

Showing posts from February, 2019

Comorbidity indexes in SQL

Generating Elixhauser comorbidity index from Danish National Health Register as relational database. (ICD 10 Coding in SAS)

A lookup-table based version of Charlson comorbidity index I made in SQL. A similar approach can be applied to Elixhauser.

SELECT V_CPR,
MAX(EI1)+MAX(EI2)+MAX(EI3)+MAX(EI4)+MAX(EI5)+
MAX(EI6)+MAX(EI7)+MAX(EI8)+MAX(EI9)+MAX(EI10)+
MAX(EI11)+MAX(EI12)+MAX(EI13)+MAX(EI14)+MAX(EI15)+
MAX(EI16)+MAX(EI17)+MAX(EI18)+MAX(EI19)+MAX(EI20)+
MAX(EI21)+MAX(EI22)+MAX(EI23)+MAX(EI24)+MAX(EI25)+
MAX(EI26)+MAX(EI27)+MAX(EI28)+MAX(EI29)+MAX(EI30)+MAX(EI31) AS Elixhauser
FROM
(SELECT V_CPR,
-- Congestive Heart Failure
CASE WHEN DIAG LIKE 'DI099%'
OR DIAG LIKE 'DI110%'
OR DIAG LIKE 'DI130%'
OR DIAG LIKE 'DI132%'
OR DIAG LIKE 'DI255%'
OR DIAG LIKE 'DI420%'
OR DIAG LIKE 'DI425%'
OR DIAG LIKE 'DI426%'
OR DIAG LIKE 'DI427%'
OR DIAG LIKE 'DI428%'
OR DIAG LIKE 'DI429%'
OR DIAG LIKE 'D…