/********************************************************************************************************** * Program: pediatric_comorbidity_index_code.sas * * Purpose: To compute the pediatric comorbidity index based on ICD-9-CM and ICD-10-CM codes. * * Description: This program takes the list of ICD-9-CM and ICD-10-CM codes and outputs the pediatric comorbidity index value for each patient in the study. * * Citation: Sun JW, Bourgeois FT, Haneuse S, Hernandez-Diaz S, Landon J, Bateman BT, Huybrechts KF. Development and Validation of a Pediatric Comorbidity Index. * * Definitions: This program assumes that the input dataset of diagnosis codes are structured according to the "Diagnosis" table from the Sentinel Common Data Model (CDM). Input datasets that use a different structure should be modified as follows. datain = input datset * patid = Unique identifier for each patient dx = ICD variable dx_codetype = ICD code type: "09" for ICD-9-CM, "10" for ICD-10-CM ; * * Comments: After merging the final data file (pediatric_index) with the analytic data file, patients with missing pediatric comorbidity index values (i.e., pediatric_index = .) should be set to 0, as these patients did not have any of the component conditions. * ********************************************************************************************************/ *Identify conditions; data conditions; set datain; length disease $25; disease = "nopoints"; if (dx_codetype="10" and (substr(dx,1,3) = "F10" or dx = "Z7141" or substr(dx,1,3) = "K70")) or (dx_codetype="09" and (substr(dx,1,3) = "291" or substr(dx,1,3) = "303" or substr(dx,1,4) = "3050" or substr(dx,1,4) = "5710" or substr(dx,1,4) = "5711" or substr(dx,1,4) = "5712" or substr(dx,1,4) = "5713" or dx = "E8600" or dx = "V113")) then disease="alcohol_abuse"; if (dx_codetype="10" and (substr(dx,1,3) = "D50" or substr(dx,1,3) = "D51" or substr(dx,1,3) = "D52" or substr(dx,1,3) = "D53" or substr(dx,1,3) = "D55" or substr(dx,1,3) = "D56" or substr(dx,1,3) = "D57")) or (dx_codetype="09" and (substr(dx,1,3) = "280" or substr(dx,1,3) = "281" or dx = "2822" or dx = "2823" or substr(dx,1,4) = "2824" or dx = "2825" or substr(dx,1,4) = "2826")) then disease="anemia"; if (dx_codetype="10" and (dx = "F064" or substr(dx,1,3) = "F40" or substr(dx,1,3) = "F41" or dx = "F430" or dx = "F4322" or dx = "F438" or dx = "F439")) or (dx_codetype="09" and (dx = "29384" or substr(dx,1,4) = "3002" or substr(dx,1,4) = "3000" or dx = "3089" or dx = "30924" or dx = "30989" or dx = "3099")) then disease="anxiety"; if (dx_codetype="10" and ("C00" <= substr(dx,1,3) <= "C14" or "C15" <= substr(dx,1,3) <= "C26" or "C30" <= substr(dx,1,3) <= "C39" or "C40" <= substr(dx,1,3) <= "C41" or substr(dx,1,3) = "C43" or "C45" <= substr(dx,1,3) <= "C49" or substr(dx,1,3) = "C50" or "C51" <= substr(dx,1,3) <= "C58" or "C60" <= substr(dx,1,3) <= "C63" or "C64" <= substr(dx,1,3) <= "C68" or "C69" <= substr(dx,1,3) <= "C72" or "C73" <= substr(dx,1,3) <= "C75" or substr(dx,1,3) = "C76" or "C81" <= substr(dx,1,3) <= "C93" or "C940" <= substr(dx,1,4) <= "C943" or substr(dx,1,4) = "C948" or substr(dx,1,3) = "C95" or dx = "C960" or substr(dx,1,4) = "C962" or dx = "C964" or dx = "C969" or dx = "C96A" or dx = "C96Z" or dx = "D45")) or (dx_codetype="09" and ("140" <= substr(dx,1,3) <= "171" or "174" <= substr(dx,1,3) <= "195" or "200" <= substr(dx,1,3) <= "208" or dx = "2730" or dx = "2733" or dx = "V1046")) then disease="any_malignancy"; if (dx_codetype="10" and substr(dx,1,3) = "J45") or (dx_codetype="09" and substr(dx,1,3) = "493") then disease="asthma"; if (dx_codetype="10" and ("I00" <= substr(dx,1,3) <= "I02" or "I05" <= substr(dx,1,3) <= "I09" or "I10" <= substr(dx,1,3) <= "I16" or "I20" <= substr(dx,1,3) <= "I25" or "I26" <= substr(dx,1,3) <= "I28" or "I30" <= substr(dx,1,3) <= "I52" or "I60" <= substr(dx,1,3) <= "I69" or "I70" <= substr(dx,1,3) <= "I79" or "I80" <= substr(dx,1,3) <= "I89" or "I95" <= substr(dx,1,3) <= "I99")) or (dx_codetype="09" and ("390" <= substr(dx,1,3) <= "392" or "393" <= substr(dx,1,3) <= "398" or "401" <= substr(dx,1,3) <= "405" or "410" <= substr(dx,1,3) <= "414" or "415" <= substr(dx,1,3) <= "417" or "420" <= substr(dx,1,3) <= "429" or "430" <= substr(dx,1,3) <= "438" or "440" <= substr(dx,1,3) <= "449" or "451" <= substr(dx,1,3) <= "459")) then disease="cardiovascular_conditions"; if (dx_codetype="10" and (substr(dx,1,3) = "Q90" or substr(dx,1,3) = "Q91" or substr(dx,1,3) = "Q92" or substr(dx,1,3) = "Q93" or substr(dx,1,3) = "Q95" or substr(dx,1,3) = "Q96" or substr(dx,1,3) = "Q97" or substr(dx,1,3) = "Q98" or substr(dx,1,3) = "Q99")) or (dx_codetype="09" and substr(dx,1,3) = "758") then disease="chromosomal_anomalies"; if (dx_codetype="10" and substr(dx,1,3) = "F91") or (dx_codetype="09" and (substr(dx,1,4) = "3120" or substr(dx,1,4) = "3121" or substr(dx,1,4) = "3122" or dx = "3124" or substr(dx,1,4) = "3128" or dx = "3129" or dx = "31381")) then disease="conduct_disorder"; if (dx_codetype="10" and ("Q00" <= substr(dx,1,3) <= "Q07" or "Q10" <= substr(dx,1,3) <= "Q18" or "Q20" <= substr(dx,1,3) <= "Q26" or "Q27" <= substr(dx,1,3) <= "Q28" or "Q30" <= substr(dx,1,3) <= "Q34" or "Q35" <= substr(dx,1,3) <= "Q37" or "Q38" <= substr(dx,1,3) <= "Q45" or "Q50" <= substr(dx,1,3) <= "Q56" or "Q60" <= substr(dx,1,3) <= "Q64" or "Q65" <= substr(dx,1,3) <= "Q79" or "Q80" <= substr(dx,1,3) <= "Q89")) or (dx_codetype="09" and ("740" <= substr(dx,1,3) <= "746" or substr(dx,1,3) = "759" or "747" <= substr(dx,1,3) <= "757")) then disease="congenital_malformations"; if (dx_codetype="10" and (substr(dx,1,3) = "F32" or substr(dx,1,3) = "F33" or dx = "F0630" or dx = "F0631" or dx = "F0632" or dx = "F349" or dx = "F39" or dx = "F4321" or dx = "F4323")) or (dx_codetype="09" and (dx = "29383" or substr(dx,1,4) = "2962" or substr(dx,1,4) = "2963" or substr(dx,1,4) = "2980" or dx = "3004" or dx = "3090" or dx = "3091" or dx = "30928" or dx = "311")) then disease="depression"; if (dx_codetype="10" and (substr(dx,1,3) = "F81" or dx = "R480" or substr(dx,1,3) = "F80" or dx = "H9325" or substr(dx,1,3) = "F82" or substr(dx,1,3) = "F88" or substr(dx,1,3) = "F89" or substr(dx,1,3) = "F70" or substr(dx,1,3) = "F71" or substr(dx,1,3) = "F72" or dx = "F78" or dx = "F79")) or (dx_codetype="09" and (substr(dx,1,3) = "315" or dx = "317" or substr(dx,1,3) = "318" or dx = "319")) then disease="developmental_delays"; if (dx_codetype="10" and (substr(dx,1,3) = "E08" or substr(dx,1,3) = "E09" or substr(dx,1,3) = "E10" or substr(dx,1,3) = "E11" or substr(dx,1,3) = "E13")) or (dx_codetype="09" and substr(dx,1,3) = "250") then disease="diabetes"; if (dx_codetype="10" and (substr(dx,1,3) = "F11" or substr(dx,1,3) = "F12" or substr(dx,1,3) = "F13" or substr(dx,1,3) = "F14" or substr(dx,1,3) = "F15" or substr(dx,1,3) = "F16" or substr(dx,1,3) = "F18" or substr(dx,1,3) = "F19" or substr(dx,1,3) = "F55" or dx = "Z7151")) or (dx_codetype="09" and (substr(dx,1,3) = "292" or substr(dx,1,3) = "304" or "3052" <= substr(dx,1,4) <= "3059" or dx = "V6542")) then disease="drug_abuse"; if (dx_codetype="10" and (substr(dx,1,3) = "F50")) or (dx_codetype="09" and (dx = "3071" or substr(dx,1,4) = "3075")) then disease="eating_disorders"; if (dx_codetype="10" and (substr(dx,1,3) = "G40" or substr(dx,1,3) = "R56")) or (dx_codetype="09" and (substr(dx,1,3) = "345" or substr(dx,1,4) = "7803")) then disease="epilepsy"; if (dx_codetype="10" and (substr(dx,1,3) = "K20" or substr(dx,1,3) = "K21" or substr(dx,1,3) = "K22" or dx = "K23" or substr(dx,1,3) = "K25" or substr(dx,1,3) = "K26" or substr(dx,1,3) = "K27" or substr(dx,1,3) = "K28" or substr(dx,1,3) = "K29" or dx = "K30" or substr(dx,1,3) = "K31" or substr(dx,1,3) = "K50" or substr(dx,1,3) = "K51" or substr(dx,1,3) = "K52" or substr(dx,1,3) = "K58" or substr(dx,1,4) = "Z871" or substr(dx,1,3) = "K92" or substr(dx,1,3) = "K62")) or (dx_codetype="09" and ("530" <= substr(dx,1,3) <= "537" or substr(dx,1,3) = "555" or substr(dx,1,3) = "556" or substr(dx,1,3) = "558" or dx = "5641" or substr(dx,1,4) = "V127" or substr(dx,1,3) = "578" or dx = "538" or dx = "56989" or dx = "5699")) then disease="gi_conditions"; if (dx_codetype="10" and (substr(dx,1,3) = "M21" or substr(dx,1,3) = "M24")) or (dx_codetype="09" and (substr(dx,1,3) = "736" or substr(dx,1,3) = "718")) then disease="joint_disorders"; if (dx_codetype="10" and (substr(dx,1,3) = "N91" or substr(dx,1,3) = "N92")) or (dx_codetype="09" and (substr(dx,1,3) = "626")) then disease="menstrual_disorders"; if (dx_codetype="10" and substr(dx,1,3) = "R11") or (dx_codetype="09" and substr(dx,1,4) = "7870") then disease="nausea_vomiting"; if (dx_codetype="10" and (substr(dx,1,3) = "G89" or dx = "R52" or substr(dx,1,3) = "R10" or substr(dx,1,3) = "M54" or substr(dx,1,3) = "R07" or substr(dx,1,4) = "M255" or substr(dx,1,4) = "F454")) or (dx_codetype="09" and (substr(dx,1,3) = "338" or dx = "78096" or substr(dx,1,4) = "7890" or "720" <= substr(dx,1,3) <= "724" or substr(dx,1,4) = "7865" or substr(dx,1,4) = "7194" or dx = "30780" or dx = "30789")) then disease="pain_conditions"; if (dx_codetype="10" and (substr(dx,1,3) = "F30" or substr(dx,1,3) = "F31" or dx = "F0633" or substr(dx,1,3) = "F20" or dx = "F22" or dx = "F23" or dx = "F24" or substr(dx,1,3) = "F25" or dx = "F28" or dx = "F29" or substr(dx,1,3) = "R44")) or (dx_codetype="09" and (substr(dx,1,4) = "2960" or substr(dx,1,4) = "2961" or substr(dx,1,4) = "2964" or substr(dx,1,4) = "2965" or substr(dx,1,4) = "2966" or substr(dx,1,4) = "2967" or substr(dx,1,4) = "2968" or substr(dx,1,4) = "2969" or substr(dx,1,3) = "295" or substr(dx,1,3) = "297" or substr(dx,1,3) = "298" or dx = "7801")) then disease="psychotic_disorders"; if (dx_codetype="10" and (substr(dx,1,3) = "F51" or substr(dx,1,4) = "G470" or substr(dx,1,4) = "G471" or substr(dx,1,4) = "G472" or substr(dx,1,4) = "G473" or substr(dx,1,4) = "G474" or substr(dx,1,4) = "G475" or substr(dx,1,4) = "G476" or dx = "G478" or dx = "G479")) or (dx_codetype="09" and (substr(dx,1,4) = "3074" or substr(dx,1,4) = "7805" or substr(dx,1,3) = "327" or substr(dx,1,3) = "347")) then disease="sleep_disorder"; if (dx_codetype="10" and (substr(dx,1,3) = "F17" or substr(dx,1,4) = "T652" or dx = "Z87891")) or (dx_codetype="09" and (dx = "3051" or dx = "98984" or dx = "V1582")) then disease="smoking"; if (dx_codetype="10" and ("E40" <= substr(dx,1,3) <= "E46" or dx = "E640" or dx = "R634" or dx = "R64")) or (dx_codetype="09" and ("260" <= substr(dx,1,3) <= "263")) then disease="weight_loss"; if disease ^= "nopoints"; run; proc sort nodupkey data = conditions; by patid disease; run; *Applying the weights; data conditionweights; set conditions; weight = 0; if disease = "any_malignancy" then weight = 5; if disease = "depression" then weight = 4; if disease = "diabetes" then weight = 4; if disease = "epilepsy" then weight = 4; if disease = "drug_abuse" then weight = 3; if disease = "psychotic_disorders" then weight = 3; if disease = "anemia" then weight = 2; if disease = "cardiovascular_conditions" then weight = 2; if disease = "chromosomal_anomalies" then weight = 2; if disease = "congenital_malformations" then weight = 2; if disease = "menstrual_disorders" then weight = 2; if disease = "smoking" then weight = 2; if disease = "weight_loss" then weight = 2; if disease = "alcohol_abuse" then weight = 1; if disease = "anxiety" then weight = 1; if disease = "asthma" then weight = 1; if disease = "conduct_disorder" then weight = 1; if disease = "developmental_delays" then weight = 1; if disease = "eating_disorders" then weight = 1; if disease = "gi_conditions" then weight = 1; if disease = "joint_disorders" then weight = 1; if disease = "nausea_vomiting" then weight = 1; if disease = "pain_conditions" then weight = 1; if disease = "sleep_disorder" then weight = 1; keep patid disease weight; run; *Summing the weights; data pediatric_index; set conditionweights(keep = patid weight); by patid; if first.patid then pediatric_index = 0; pediatric_index + weight; if last.patid then output; keep patid pediatric_index; run;