** SAS Code for Surgical/Medical/Obstetrical Inpatient Identification **********************************************************; ** SAS Code for identifying surgical/medical inpatients using DRGs ; ** READ Hospital Separation Abstract FILE ; **format 'S'urgical' or 'M'edical DRG; DRGSM = put(DRG, $drg13sm.); IF TRANCODE = "inpatient" then **select surgical inpatient; IF DRGSM = "surgical" THEN SURGIN = "true"; ELSE SURGIN = "false"; **********************************************************; ** SAS Code for identifying surgical/medical inpatients using CMGs ; ** READ Hospital Separation Abstract FILE ; **format 'S'urgical' or 'M'edical CMG; CMGSM = PUT(CMG, $cmg95sm.); IF TRANCODE = "inpatient" then **select surgical inpatient; IF CMGSM = "surgical" THEN SURGIN = "true"; ELSE SURGIN = "false"; **********************************************************; ** SAS Code for identifying obstetrical/surgical inpatients using ICD-9-CM Codes ; ** READ Hospital Separation Abstract FILE ; **format most responsible diagnosis to 4 char; DIAG4=SUBSTR(DX01,1,4); **identify 'O'bstetrical or Other diagnosis; NOBST=PUT(DIAG4,$INOBST.); IF TRANCODE = "inpatient" then **format 'S'urgical/'O'ther procedure; INSURG=PUT(PROC01,$INSURG.); **select obstetrical/surgical/medical; IF INOBST='O' THEN INOBSURG='O'; ELSE IF INSURG='S' THEN INOBSURG='S'; ELSE INOBSURG='M';