*****************************************; ******* 2003/04 and earlier: DRGS *******; *****************************************; *** Example: 1999/00 hospital data; *** set together hospital data and corresponding DRG file; data hosp9900; set cpe8.hsp9900; set cpe8.d11_hs00 (keep=g1115drg); drgsm = put(g1115drg,$drg15sm.); *** 1=surg, 2=med, 3=other, 0=missing; *** assign ungroupable DRGs to surgical or medical based on presence of OP01; if g1115drg in ('468', '470') then do; if op01 = ' ' then drgsm = '2'; *** Assign cases without op01 to Medical; else if op01 ^= ' ' then drgsm = '1'; *** Assign cases with op01 to Surgical; else drgsm = ' '; end; *** keep inpatients and surgical outpatients; if transact = '1' | (transact = '3’ & drgsm = '1'); *** delete biopsies, no longer required to be recorded as of April 1, 2001; *** biopsies will be excluded from hospital separation counts; if transact^='1' and op01 in: ('861', '862', '863') then delete; run; *************************************; ******* 2004/05-2008/09: DPGs *******; *************************************; *** Example: 2004/05 hospital data (same for 2005/06-2007/08, 2009 version is available on 2008/09 hospital data); *** merge together hospital data and CIHI CMG extras to get 2009 version DPG variable; proc sql; create table hosp0405 as select h.*, c.dpg as dpg_new from cpe8.hsp0405 as h left join cpe8.cmgplus20042005v2009 as c on h.cihi_key=c.cihi_key_fix and input(h.sepdt,yymmdd8.)=c.sepdt; quit; data hosp0405; set hosp0405 (where=(provcd = 'MB‘)); *** create transact variable; if admcategory = 'S' then transact = '9'; else if substr(institution,2,1) in ('0','3','5','6') then transact = '1'; else if substr(institution,2,1) in ('1','7') then transact = '3'; *** identify surgical outpatients; day_surg = put(dpg_new,dpg09ds.); *** in cpe/fmtlib/hosp; *** keep inpatients and surgical outpatients; if transact = '1' | (transact = '3' & day_surg = 'Y’); *** delete biopsies, no longer required to be recorded as of April 1, 2001; *** biopsies will be excluded from hospital separation counts; if transact ^= '1' and substr(intcd01,1,2) = '1Y' and substr(intcd01,4,2) in ('59','87') then delete; if transact ^= '1' and substr(intcd01,1,2) = '2Y' and substr(intcd01,4,2) = '71' then delete; run; *******************************************************************; ******* Old Method: ICD-9-CM Codes (OUTDATED, DO NOT USE!!) *******; *******************************************************************; **read in outpatient hospital abstracts; READ OUTPAT; **format 'M'edical/'S'urgical/'X'Other designation; SURGMED=PUT(PROC,$SURGMED.); **select surgical outpatient; IF SURGMED='S' then SURGOUT = "true"; ELSE SURGOUT = "false";