/******************************************************************/
/* Title:  CREATION OF FORMAT LIBRARY FOR COMORBIDITY GROUPS      */
/*         COMORBIDITY SOFTWARE, VERSION 3.2                      */
/*                                                                */
/* Description:                                                   */
/*    Define all ICD codes and labels for each format             */
/*                                                                */
/* 01/16/07:    Version 3.2                                       */
/*              new DRG codes for cardiac and nervous system.     */
/* 10/25/05:    Version 3.1 contains the updated ICD-9-CM codes   */
/*              for 2006. These codes are found in the renal      */
/*              failure and alcohol abuse formats. There are also */
/*              new DRG codes for cardiac and nervous system.     */
/* 01/04/05:    Added FY2005 DRG 543 (CRANIOTOMY WITH IMPLANT-    */
/*              ATION OF CHEMOTHERAPEUTIC AGENT OR ACUTE COMPLEX  */
/*              CENTRAL NERVOUS SYSTEM PRINCIPAL DIAGNOSIS) to    */
/*              the "NERVDRG" DRG exclusion format.  Includes     */
/*              cases previously assigned to DRGs 1 and 2.        */
/* 11/29/04:    Version 3.0 contains the updated ICD-9-CM codes   */
/*              for 2005. These codes can be found in the "Other  */
/*              Neurological" format. This format now handles DX  */
/*              codes that are not comorbidities differently:     */
/*              When used with the Comoanaly software, the        */
/*              temporary variable DXVALUE is assigned to blank.  */
/* 07/29/04:    Version 2.1 is a minor update that allows for     */
/*              several comorbidities to share the same           */
/*              diagnosis codes, something that has not been done */ 
/*              before because this SAS format does not allow for */
/*              overlapping or repeating values. In order to work */
/*              around this SAS constraint, the comorbidities for */
/*              Congestive Heart Failure and Hypertension         */
/*              Complicated have to be defined in the file        */    
/*              comoanaly2004.txt when they overlap with each     */
/*              other or Renal Failure.                           */   
/******************************************************************/

/***************************************************/
/* Define the subdirectory for the FORMAT library  */
/* Output file:  C:\COMORB\FMTLIB\FORMATS.sc2      */
/***************************************************/

Libname library 'C:\COMORB\FMTLIB\';


TITLE1 'CREATE FORMAT LIBRARY OF ICD CODES AND LABELS';
  
PROC FORMAT LIB=library fmtlib;
   VALUE $RCOMFMT

      "39891",
      "4280 "-"4289 " = "CHF"       /* Congestive heart failure */

   
      "09320"-"09324",
      "3940 "-"3971 ",
      "3979 ", 
      "4240 "-"42499",
      "7463 "-"7466 ",
      "V422 ",
      "V433 " = "VALVE"             /* Valvular disease */


      "4160 "-"4169 ",
      "4179 " = "PULMCIRC"          /* Pulmonary circulation disorder */


      "4400 "-"4409 ",
      "44100"-"4419 ",
      "4420 "-"4429 ",
      "4431 "-"4439 ",
      "4471 ",
      "5571 ",
      "5579 ",
      "V434 " = "PERIVASC"          /* Peripheral vascular disorder */


      "4011 ",
      "4019 ",
      "64200"-"64204" = "HTN"       /* Hypertension, uncomplicated */

      "4010 ",
      "4372 " = "HTNCX"             /* Hypertension, complicated */


      /******************************************************************/
      /* The following are special, temporary formats used in the       */
      /* creation of the hypertension complicated comorbidity when      */
      /* overlapping with congestive heart failure or renal failure     */
      /* occurs. These temporary formats are referenced in the program  */
      /* called comoanaly2004.txt.                                      */
      /******************************************************************/
      "64220"-"64224" = "HTNPREG"   /* Pre-existing hypertension complicating pregnancy */


      "40200",
      "40210",
      "40290",  
      "40509",    
      "40519",
      "40599" = "HTNWOCHF"          /* Hypertensive heart disease without heart failure */


      "40201",
      "40211",
      "40291" = "HTNWCHF"           /* Hypertensive heart disease with heart failure */


      "40300",
      "40310",
      "40390",
      "40501",
      "40511",
      "40591",
      "64210"-"64214" = "HRENWORF"  /* Hypertensive renal disease without renal failure */


      "40301",
      "40311",
      "40391" = "HRENWRF"           /* Hypertensive renal disease with renal failure */  


      "40400",
      "40410",
      "40490" = "HHRWOHRF"          /* Hypertensive heart and renal disease without heart or renal failure */


      "40401",
      "40411",
      "40491" = "HHRWCHF"           /* Hypertensive heart and renal disease with heart failure */


      "40402",
      "40412",
      "40492" = "HHRWRF"            /* Hypertensive heart and renal disease with renal failure */


      "40403",
      "40413",
      "40493" = "HHRWHRF"           /* Hypertensive heart and renal disease with heart and renal failure */ 
 

      "64270"-"64274",
      "64290"-"64294" = "OHTNPREG"  /* Other hypertension in pregnancy */

      /******************** End Temporary Formats ***********************/


      "3420 "-"3449 ",
      "43820"-"43853" = "PARA"      /* Paralysis */


      "3300 "-"3319 ",
      "3320 ",
      "3334 ",
      "3335 ",
      "3337 ",
      "33371","33372","33379","33385","33394",
      "3340 "-"3359 ",
      "3380 ",
      "340  ",
      "3411 "-"3419 ",
      "34500"-"34511",
      "3452 "-"3453 ", 
      "34540"-"34591",
      "34700"-"34701",
      "34710"-"34711",
      "64940"-"64944",
      "7687 ",
      "7803 ",
      "78031",
      "78032",
      "78039",
      "78097",
      "7843 "
              = "NEURO"             /* Other neurological */


      "490  "-"4928 ",
      "49300"-"49392",
      "494  "-"4941 ",
      "4950 "-"505  ",
      "5064 " = "CHRNLUNG"          /* Chronic pulmonary disease */


      "25000"-"25033", 
      "64800"-"64804" = "DM"        /* Diabetes w/o chronic complications*/


      "25040"-"25093", 
      "7751 " = "DMCX"              /* Diabetes w/ chronic complications */


      "243  "-"2442 ",
      "2448 ",
      "2449 " = "HYPOTHY"           /* Hypothyroidism */


      "5853 ",
      "5854 ",
      "5855 ",
      "5856 ",
      "5859 ",
      "586  ",
      "V420 ",
      "V451 ",
      "V560 "-"V5632",
      "V568 " = "RENLFAIL"          /* Renal failure */

      
      "07022",
      "07023",
      "07032",
      "07033",
      "07044",
      "07054",
      "4560 ",
      "4561 ",
      "45620",
      "45621", 
      "5710 ",
      "5712 ",
      "5713 ",
      "57140"-"57149",
      "5715 ",
      "5716 ",
      "5718 ",
      "5719 ",
      "5723 ",
      "5728 ",
      "V427 " = "LIVER"             /* Liver disease */


      "53141",
      "53151",
      "53161",
      "53170",
      "53171",
      "53191",
      "53241",
      "53251",
      "53261",
      "53270",
      "53271",
      "53291",
      "53341",
      "53351",
      "53361",
      "53370",
      "53371",
      "53391",
      "53441",
      "53451",
      "53461",
      "53470",
      "53471",
      "53491" = "ULCER"             /* Chronic Peptic ulcer disease (includes bleeding only if obstruction is also present) */


      "042  "-"0449 " = "AIDS"      /* HIV and AIDS */


      "20000"-"20238",
      "20250"-"20301",
      "2038 "-"20381",
      "2386 ",
      "2733 " = "LYMPH"             /* Lymphoma */


      "1960 "-"1991 " = "METS"      /* Metastatic cancer */


      "1400 "-"1729 ",
      "1740 "-"1759 ",
      "179  "-"1958 " = "TUMOR"     /* Solid tumor without metastasis */


      "7010 ",
      "7100 "-"7109 ", 
      "7140 "-"7149 ",
      "7200 "-"7209 ",
      "725  " = "ARTH"              /* Rheumatoid arthritis/collagen vascular diseases */


      "2860 "-"2869 ",
      "2871 ",
      "2873 "-"2875 ",
      "64930"-"64934" 
                      = "COAG"      /* Coagulation deficiency - note:
                                     this comorbidity should be dropped when
                                     used with the AHRQ Patient Safety Indicators */


      "2780 ",
      "27800",
      "27801",
      "64910"-"64914",
      "V8530"-"V8539",
      "V854 ",
      "V8554",
      "79391" 
              = "OBESE"             /* Obesity      */
                                   
      "260  "-"2639 ",
      "78321"-"78322" = "WGHTLOSS"  /* Weight loss */

      "2760 "-"2769 " = "LYTES"     /* Fluid and electrolyte disorders - note:
                                      this comorbidity should be dropped when
                                      used with the AHRQ Patient Safety Indicators*/

      "2800 ", 
      "64820"-"64824" = "BLDLOSS"   /* Blood loss anemia */


      "2801 "-"2819 ",
      "28521"-"28529",
      "2859 " = "ANEMDEF"           /* Deficiency anemias */


      "2910 "-"2913 ",
      "2915 ",
      "2918 ",
      "29181",
      "29182",
      "29189",
      "2919 ",
      "30300"-"30393",
      "30500"-"30503" = "ALCOHOL"   /* Alcohol abuse */


      "2920 ",
      "29282"-"29289",
      "2929 ",
      "30400"-"30493",
      "30520"-"30593", 
      "64830"-"64834" = "DRUG"      /* Drug abuse */


      "29500"-"2989 ",
      "29910",
      "29911" = "PSYCH"             /* Psychoses */


      "3004 ",
      "30112",
      "3090 ",
      "3091 ",
      "311  " = "DEPRESS"          /* Depression */

      Other   = " "
    ;


    /** DRG Formats  **/
  

    VALUE CARDDRG                       /* Cardiac */
        103-112,115-118,121-127,129,132,133,
        135-143,514-518,524-527, 535-536,
        547-550, 551-558 = "YES" ;

     VALUE PERIDRG                      /* Peripheral vascular */
        130,131 = "YES" ;

     VALUE RENALDRG                     /* Renal */
        302-305,315-333 = "YES" ;

     VALUE NERVDRG                      /* Nervous system */
        1-35,524,528-534,543,559-564,577 = "YES" ;

     VALUE CEREDRG                      /* Cerebrovascular */
        5,14-17,524,528,533-534,577 = "YES" ;

     VALUE PULMDRG                      /* COPD asthma */
        88,96-98 = "YES" ;

     VALUE  DIABDRG                     /* Diabetes */
        294,295  = "YES" ;

     VALUE HYPODRG                      /* Thyroid endocrine */
        290,300,301 = "YES";

     VALUE RENFDRG                      /* Kidney transp, renal fail/dialysis */
        302,316,317  = "YES" ;

     VALUE LIVERDRG                     /* Liver */
        199-202,205-208 = "YES" ;

     VALUE ULCEDRG                      /* GI hemorrhage or ulcer */
        174-178  = "YES"  ;

     VALUE HIVDRG                       /* Human immunodeficiency virus */
        488,489,490  = "YES" ;

     VALUE LEUKDRG                      /* Leukemia/lymphoma */
        400-414,473,492,539-540 = "YES"  ;

     VALUE CANCDRG                      /* Cancer, lymphoma */
        10,11,64,82,172,173,199,203,239,
        257-260,274,275,303,318,319,
        338,344,346,347,354,355,357,363,366,
        367,406-414 = "YES"   ;

     VALUE ARTHDRG                      /* Connective tissue */
        240,241 = "YES"  ;

     VALUE NUTRDRG                      /* Nutrition/metabolic */
        296-298 = "YES"  ;

     VALUE ANEMDRG                      /* Anemia */
        395,396,574 = "YES";

     VALUE ALCDRG                       /* Alcohol drug */
        433-437,521-523 = "YES" ;

     VALUE COAGDRG			/*Coagulation disorders*/
        397 = "YES";

     VALUE HTNCXDRG                     /*Hypertensive Complicated  */
        22,134 = "YES" ;

     VALUE HTNDRG                       /*Hypertensive Uncomplicated  */
        134 = "YES" ;

RUN;