*********************************************************************************************** *****************Alcohol Attributable Fractions - Hospitalizations and Deaths****************** *********************************************************************************************** *File originally created in June 2012, by Katherine Russel from Ottawa Public Health *Revised By Suzanne Fegan in July 2014, KFL&A Public Health for Core Indicators ********************************************************************************** *Inpatient Discharges - DAD - Chronic Diseases and Neuro-psychiatris conditions ********************************************************************************** * rename variable names ren A__Dschg__D_ dschg ren Patient_PHU phu ren ICD10_Code__4_char__ONLY_MRDx ICDCAcode encode Patient_PHU, gen(PHU) *Split the ICD char code into a variabe for each character *The 'ICDa' variable is now the 'letter' part of the ICD-10 code *The 'ICDnum' variable is not the 'number' part of the ICD-10 code gen ICDa=substr(ICDCAcode,1,1) gen ICD1=substr(ICDCAcode,2,1) gen ICD2=substr(ICDCAcode,3,1) gen ICD3=substr(ICDCAcode,4,1) destring ICD1, replace destring ICD2, replace destring ICD3, replace gen ICD3new=ICD3 replace ICD3new=0 if ICD3new==. /* keep original ICD3 to show when there wasn't a 4th character. ICD3new will add a 0 where the 4th character was previously missing - this will allow the codes to be derived in ranges*/ gen ICDnum=string(ICD1) + string(ICD2) + string(ICD3new) * categorize into conditions /* Cancers */ gen mouthca=1 if (ICDa=="C" & ICDnum>="000" & ICDnum<="149") /* Mouth and oropharynx cancers */ label var mouthca "Mouth and oropharynx cancers" gen esophca=1 if (ICDa=="C" & ICDnum>="150" & ICDnum<="159") /* Esophageal cancers */ label var esophca "Esophageal cancers" gen liverca=1 if (ICDa=="C" & ICDnum>="220" & ICDnum<="229") /* Liver cancers */ label var liverca "Liver cancer" gen larynca=1 if (ICDa=="C" & ICDnum>="320" & ICDnum<="329") /* Laryngeal cancers */ label var larynca "Laryngeal cancer" gen breastca=1 if (ICDa=="C" & ICDnum>="500" & ICDnum<="509") /* Breast cancers */ label var breastca "Breast cancer" gen otherca=1 if (ICDa=="D" & ICDnum>="000" & ICDnum<="489") /* Other cancers */ label var otherca "Other cancers" tab1 mouthca esophca larynca liverca otherca [fweight=dschg] if sex=="M" tab1 mouthca esophca larynca liverca otherca [fweight=dschg] if sex=="F" /* Age group for Breast Cancer */ *Please note, this section was completed assuming data for those only ages 15 to 69 were pulled. *you will have to revise this section according, if you pulled all ages. *eg. The variable age5yr starts with the 5 year age group 15 to 19, and when the encode command is used, it gets a value of '1'. encode agegrp5yr, gen(age5yr) * age group 15-69 = age5yr values 1-11 * for breast cancer, the age group for the RRs is 15-44 (age5y= 1-6) and 45-69 (age5yr=7-11) gen agecat=. replace agecat=1 if age5yr>=1 & age5yr<=6 replace agecat=2 if age5yr>=7 & age5yr<=11 label define agecat 1 "15-44yrs" 2 "45-69yrs" label values agecat agecat /*Breast Cancer*/ bysort sex: tab agecat breastca [fweight=dsch] /* Diabetes */ gen diabetes=1 if (ICDa=="E" & ICDnum>="100" & ICDnum<="149") /* Diabetes */ label var diabetes "Diabetes" tab1 diabetes [fweight=dschg] if sex=="M" tab1 diabetes [fweight=dschg] if sex=="F" /* Neuro-psychiatric conditions */ *All of these conditions, excpet epilepsy, go into the 100% AAF Diseases tab in the Excel spreadsheet gen alcpsych=1 if (ICDa=="F" & (ICDnum=="100" | (ICDnum>="103" & ICDnum<="109"))) /* Alcoholic psychoses */ label var alcpsych "Alcoholic psychoses" gen alcdep=1 if (ICDa=="F" & ICDnum=="102") /* Alcohol dependence syndrome */ label var alcdep "Alcohol dependence syndrome" gen alcabuse=1 if (ICDa=="F" & ICDnum=="101") /* Alcohol abuse */ label var alcabuse "Alcohol abuse" gen degenns=1 if (ICDa=="G" & ICDnum=="312") /* Degeneration of nervous system due to alcohol */ label var degenns "Degeneration of nervous system due to alcohol" gen unidep=1 if (ICDa=="F" & ICDnum>="320" & ICDnum<="339") /* Unipolar major depression */ label var unidep "Unipolar major depression" gen alcpolyneuro=1 if (ICDa=="G" & ICDnum=="621") /* Alcoholic polyneuropathy */ label var alcpolyneuro "Alcoholic polyneuropathy" gen epilepsy=1 if (ICDa=="G" & (ICDnum>="400" & ICDnum<="419")) /* Epilepsy */ label var epilepsy "Epilepsy" tab1 alcpsych alcabuse alcdep unidep degenns epilepsy alcpolyneuro [fweight=dschg] if sex=="M" tab1 alcpsych alcabuse alcdep unidep degenns epilepsy alcpolyneuro [fweight=dschg] if sex=="F" /* Cardiovascular diseases */ gen hyper=1 if (ICDa=="I" & (ICDnum>="100" & ICDnum<="159")) /* Hypertensive disease */ label var hyper "Hypertensive disease" gen ihd=1 if (ICDa=="I" & (ICDnum>="200" & ICDnum<="259")) /* Ischaemic heart disease */ label var ihd "Ischaemic heart disease" gen alccardio=1 if (ICDa=="I" & ICDnum=="426") /* Alcoholic cardiomyopathy */ label var cardarr "Cardiac arrhythmias" gen heartfail=1 if (ICDa=="I" & ((ICDnum>="500" & ICDnum<="529") | (ICDnum>="230" & ICDnum<="239") | ICDnum=="250" | ICDnum=="970" | ICDnum=="971" | ICDnum=="981")) /* Heart failure and ill-defined complications */ label var heartfail "Heart failure and ill-defined complications of heart failure" gen cerebro=1 if (ICDa=="I" & (ICDnum>="600" & ICDnum<="699")) /* Cerebrovascular disease */ label var cerebro "Cerebrovascular disease" gen cerebromod=1 if (ICDa=="I" & (ICDnum>="670" & ICDnum<="699")) /* Cerebrovascular disease less ishaemic and haemorrhagic stroke*/ label var cerebromod "Cerebrovascular disease less ischaemic and haemorrhagic stroke" gen istroke=1 if (ICDa=="I" & (ICDnum>="630" & ICDnum<="669")) /* Ischaemic stroke */ label var istroke "Ischaemic stroke" gen hstroke=1 if (ICDa=="I" & (ICDnum>="600" & ICDnum<="629")) /* Haemorrhagic stroke */ label var hstroke "Haemorrhagic stroke" gen ovarices=1 if (ICDa=="I" & (ICDnum>="850" & ICDnum<="859")) /* Oesophageal varices */ label var ovarices "Oesophageal varices" *100% AAF - goes in the 100% AAF Diseases tab in the Excel spreadsheet* label var alccardio "Alcoholic cardiomyopathy" gen cardarr=1 if (ICDa=="I" & (ICDnum>="470" & ICDnum<="499")) /* Cardiac arrhythmias */ tab1 hyper ihd alccardio cardarr heartfail cerebromod istroke hstroke ovarices [fweight=dschg] if sex=="M" tab1 hyper ihd alccardio cardarr heartfail cerebromod istroke hstroke ovarices [fweight=dschg] if sex=="F" /* Digestive diseases */ gen cirrliver=1 if (ICDa=="K" & ((ICDnum>="700" & ICDnum<="709") | (ICDnum>="740" & ICDnum<="749"))) /* Cirrhosis of the liver */ label var cirrliver "Cirrhosis of the liver" gen chole=1 if (ICDa=="K" & (ICDnum>="800" & ICDnum<="809")) /* Cholelithiasis */ label var chole "Cholelithiasis" gen pancreatitis=1 if (ICDa=="K" & ((ICDnum>="850" & ICDnum<="859") | (ICDnum=="861"))) /* Acute and chronic pancreatitis */ label var pancreatitis "Acute and chronic pancreatitis" *100% AAF - goes in the 100% AAF Diseases tab in the Excel spreadsheet* gen alcgast=1 if (ICDa=="K" & ICDnum=="292") /* Alcoholic gastritis */ label var alcgast "Alcoholic gastritis" gen alpanc=1 if (ICDa=="K" & ICDnum=="860") /* Alcoholic pancreatitis */ label var alpanc "Alcoholic (chronic) pancreatitis" tab1 alcgast cirrliver chole pancreatitis alpanc [fweight=dschg] if sex=="M" tab1 alcgast cirrliver chole pancreatitis alpanc [fweight=dschg] if sex=="F" /* Skin diseases */ gen psor=1 if (ICDa=="L" & (ICDnum>="400" & ICDnum<="409")) /* Psoriasis */ label var psor "Psoriasis" ******************************************************************** * !! OMHRS data - alcohol-related disorders!! ******************************************************************** * Alcohol-related * change variables from upper to lowercase quietly foreach oldname of varlist * { local newname=lower("`oldname'") rename `oldname' `newname' } note: Codes are based on DSM-IV. /// 291.0 Alcohol Withdrawal delirium /// 291.0 Alcohol Intoxication delirium /// 291.1 Alcohol -Induced persisting amnestic disorder /// 291.2 Alcohol -Induced persisting dementia /// 291.3 Alcohol -Induced psychotic disorder, with hallucinations /// 291.5 Alcohol -Induced psychotic disorder, with delusions /// 291.81 Alcohol Withdrawal /// 291.89 Alcohol -Induced anxiety disorder /// 291.89 Alcohol -Induced mood disorder /// 291.89 Alcohol -Induced sexual dysfunction /// 291.89 Alcohol -Induced sleep disorder /// 291.9 Alcohol -Related disorder NOS /// 303.00 Alcohol Intoxication /// 303.90 Dependence /// 305.00 Abuse * rename variable names ren patientphu phu ren dsmivaxisiprimarydxcodeon dsm destring dsm, replace label define dsm /// 29100 "Alcohol Withdrawal/Intoxication delirium" /// 29110 "Alcohol Induced persisting amnestic disorder" /// 29120 "Alcohol Induced persisting dementia" /// 29130 "Alcohol Induced psychotic disorder, with hallucinations" /// 29150 "Alcohol Induced psychotic disorder, with delusions" /// 29181 "Alcohol Withdrawal" /// 29189 "Alcohol Induced anxiety/mood disorder, sexual dysfunction, sleep disorder" /// 29190 "Alcohol Related disorder NOS" /// 30300 "Alcohol Intoxication" /// 30390 "Dependence" /// 30500 "Abuse" label values dsm dsm gen alwithdelerium=1 if dsm==29100 label var alwithdelerium "Alcohol Withdrawal/Intoxication delirium" gen alamnestic=1 if dsm==29110 label var alamnestic "Alcohol Induced persisting amnestic disorder" gen aldementia=1 if dsm==29120 label var aldementia "Alcohol Induced persisting dementia" gen alpsychotic=1 if dsm==29130 label var alpsychotic "Alcohol Induced psychotic disorder, with hallucinations" gen alpsychoticdelusions=1 if dsm==29150 label var alpsychoticdelusions "Alcohol Induced psychotic disorder, with delusions" gen alwithdrawal=1 if dsm==29181 label var alwithdrawal "Alcohol Withdrawal" gen alanx=1 if dsm==29189 label var alanx "Alcohol Induced anxiety/mood disorder, sexual dysfunction, sleep disorder" gen alnos=1 if dsm==29190 label var alnos "Alcohol Related disorder NOS" gen alintox=1 if dsm==30300 label var alintox "Alcohol Intoxication" gen aldepend=1 if dsm==30390 label var aldepend "Dependence" gen alabuse=1 if dsm==30500 label var alabuse "Abuse" * alwithdelerium alamnestic aldementia alpsychotic alpsychoticdelusions alwithrawal alanx alnos alintox aldepend alabuse /* Age group */ encode agegroup5yr, gen(age5yr) * age group 15-69 = age5yr values 5-15 * for breast cancer, the age group for the RRs is 15-44 (age5y= 5-10) and 45-69?(age5yr=11-15) gen agecat=. replace agecat=1 if age5yr>=1 & age5yr<=4 replace agecat=2 if age5yr>=5 & age5yr<=7 replace agecat=3 if age5yr>=8 & age5yr<=10 replace agecat=4 if age5yr>=11 & age5yr<=13 replace agecat=5 if age5yr>=14 & age5yr<=15 replace agecat=6 if age5yr>=16 & age5yr<=17 replace agecat=7 if age5yr>=18 & age5yr<=20 label define agecat 1 "0-14yrs" 2 "15-29yrs" 3 "30-44yrs" 4 "45-59yrs" 5 "60-69yrs" 6 "70-79yrs" 7 ">=80yrs" label values agecat agecat /* Sex */ encode sex, gen(sexnew) drop sex rename sexnew sex * females =1 males=2 *100% AAF - goes in the 100% AAF Diseases tab in the Excel spreadsheet * total pop tab1 alwithdelerium alamnestic aldementia alpsychotic alpsychoticdelusions alwithdrawal alanx alnos alintox aldepend alabuse [fweight=admitsd] * Males tab1 alwithdelerium alamnestic aldementia alpsychotic alpsychoticdelusions alwithdrawal alanx alnos alintox aldepend alabuse [fweight=admitsd] if sex==2 * Females tab1 alwithdelerium alamnestic aldementia alpsychotic alpsychoticdelusions alwithdrawal alanx alnos alintox aldepend alabuse [fweight=admitsd] if sex==1 ************************************************************************ * !! OMHRS data - depression!! ************************************************************************ * Depression *Note: weighting variable is "admitsd" PLease rename your variable accordingly. * change variables from upper to lowercase quietly foreach oldname of varlist * { local newname=lower("`oldname'") rename `oldname' `newname' } note: Codes are based on DSM-IV. /// Major depressive disorder, single episode /// 296.20 Unspecified /// 296.21 Mild /// 296.22 Moderate /// 296.23 Severe without psychotic features /// 296.24 Severe with psychotic features /// 296.25 In partial remission /// 296.26 In full remission /// Major depressive disorder, recurrent /// 296.30 Unspecified /// 296.31 Mild /// 296.32 Moderate /// 296.33 Severe without psychotic features /// 296.34 Severe with psychotic features /// 296.35 In partial remission /// 296.36 In full remission Depressvie disorder, NOS: 311 * rename variable names ren patientphu phu ren dsmivaxisiprimarydxcodeon dsmcode *Use same age category as above gen depression=1 if dsm>=29620 & dsm<=29626 gen depression=1 if dsm>=29630 & dsm<=29636 gen depression=1 if dsm==311 label var depression "Depression" * total pop tab depression [fweight=admitsd] * Males tab depression agecat [fweight=admitsd] if sex==2 * Females tab depression agecat [fweight=admitsd] if sex==1 *********************************************************************************** *External causes of injury ************************************************************************************ *Please note that the syntax below assumes you will be using one of the pre-defined reports in intellihealth *to pull the injury data. Thus, each visit will be unique and there is no need to use the svy command. **Also note, that the injuries that are 100% attributable to alcohol (100% AAF) are listed in a separate tab in the Excel spreadsheet **Motor Vehicle Traffic Collisions**. gen collision=0. #delimit ; replace collision=1 if (ICD10extcause>="V02" & ICD10extcause<="V04999") | (ICD10extcause=="V090" & ICD10extcause<="V09099") | (ICD10extcause>="V092" & ICD10extcause<="V09299") | (ICD10extcause>="V12" & ICD10extcause<="V14999") | (ICD10extcause>="V190" & ICD10extcause<="V19299") | (ICD10extcause>="V194" & ICD10extcause<="V19499") | (ICD10extcause>="V196" & ICD10extcause<="V19699") | (ICD10extcause>="V20" & ICD10extcause<="V79999") | (ICD10extcause>="V803" & ICD10extcause<="V80599") | (ICD10extcause>="V809" & ICD10extcause<="V80999") | (ICD10extcause>="V810" & ICD10extcause<="V81199") | (ICD10extcause>="V820" & ICD10extcause<="V82199") | (ICD10extcause>="V828" & ICD10extcause<="V82899") | (ICD10extcause>="V83" & ICD10extcause<="V86999") | (ICD10extcause>="V870" & ICD10extcause<="V87899") | (ICD10extcause>="V880" & ICD10extcause<="V88899") | (ICD10extcause>="V890" & ICD10extcause<="V89099") | (ICD10extcause>="V892" & ICD10extcause<="V89299") ; #delimit cr tab collision if sex=="M" tab collision if sex=="F" *****Poisoning******* *(accidental alcohol poisoning X-45 is in a separate category below). gen poisoning=0. replace poisoning=1 if ICD10extcause>="X40" & ICD10extcause<="X44999" replace poisoning=1 if ICD10extcause>="X46" & ICD10extcause<="X49999" tab poisoning if sex=="M" tab poisoning if sex=="F" *100% AAF - goes in the 100% AAF Injuries tab in the Excel spreadsheet *Accidental poisoning & exposure to alcohol X45 gen accpoisonalcohol=. replace accpoisonalcohol=1 if ICD10extcause=="X45" tab accpoisonalcohol if sex=="M" tab accpoisonalcohol if sex=="F" *****Falls******* gen falls=0. replace falls=1 if ICD10extcause>="W00" & ICD10extcause<="W19999" tab falls if sex=="M" tab falls if sex=="F" ********Fire******* gen fire=0. replace fire=1 if ICD10extcause>="X00" & ICD10extcause<="X09999" tab fire if sex=="M" tab fire if sex=="F" *****Drowning******* gen drowning=0. replace drowning=1 if ICD10extcause>="W65" & ICD10extcause<="W74999" tab drowning if sex=="M" tab drowning if sex=="F" ********Other unintentional injuries**************** *You can either put the number for each of the other unintentional injuries categories in separately, *or, you can use the overall other unintentional injury category listed at the end here) **other land transport accidents - Other 'V' codes other than MVC's (collision's from above) gen otherlandtrans=. replace otherlandtrans=1 if (ICD10extcause>="V00" & ICD10extcause<="V9999") & collision!=1 tab otherandtrans if sex=="M" tab otherlandtrans if sex=="F" **Exposure to inanimate mechanical forces - W20-49 gen inanimate=0. replace inanimate=1 if ICD10extcause>="W20" & ICD10extcause<="W49999" tab inanimate if sex=="M" tab inanimate if sex=="F" **Exposure to animate mechanical forces - W50-64 gen animate=0. replace animate=1 if ICD10extcause>="W50" & ICD10extcause<="W64999" tab animate if sex=="M" tab animate if sex=="F" **Other threats to breathing, electric current, radiation etc. W75-84, W85-99 gen otherunint=0 replace otherunint=1 if ICD10extcause>="W75" & ICD10extcause<="W99999" tab otherunint if sex=="M" tab otherunint if sex=="F" **Heat and hot substances, venomous animals and plants, forces of nature gen otherunint2=0 replace otherunint2=1 if ICD10extcause>="X10" & ICD10extcause<="X39999" tab otherunint2 if sex=="M" tab otherunint2 if sex=="F" **Overexertion, travel and privation, and other - X50-57 and X58-59 gen overexert=0. replace overexert=1 if ICD10extcause>="X50" & ICD10extcause<="X59999" tab overexert if sex=="M" tab overexert if sex=="F" **other unintentional gen otherunint3=0 replace otherunint3=1 if ICD10extcause>="Y850" & ICD10extcause<="Y86999" tab otherunint3 if sex=="M" tab otherunint3 if sex=="F" **Overall 'other unintentional injuries category' gen overallotherunint=0 replace overallotherunint=1 if otherlandtrans==1 | inanimate==1 | animate==1 | otherunint==1 | otherunint2==1 | overexert==1 | otherunint3==1 *******Intentional Self-harm**************** gen intselfharm=0. replace intselfharm=1 if ICD10extcause>="X60" & ICD10extcause<="X64999" replace intselfharm=1 if ICD10extcause>="X66" & ICD10extcause<="X84999" replace intselfharm=1 if ICD10extcause=="Y870" tab intselfharm if sex=="M" tab intselfharm if sex=="F" *100% AAF - goes in the 100% AAF Injuries tab in the Excel spreadsheet *Intentional self-poisoning by and exposure to alcohol X65 gen intpoisonalcohol=. replace intpoisonalcohol=1 if ICD10extcause=="X65" tab intpoisonalcohol if sex=="M" tab intpoisonalcohol if sex=="F" ************Homicide******************** gen homicide=0. replace homicide=1 if ICD10extcause>="X85" & ICD10extcause<="X9999" replace homicide=1 if ICD10extcause>="Y00" & ICD10extcause<="Y09999" replace homicide=1 if ICD10extcause=="Y871" tab homicide if sex=="M" tab homicide if sex=="F" **************Other intentional injuries************ gen otherintinj=0. replace otherintinj=1 if ICD10extcause=="Y35" tab otherintinj if sex=="M" tab otherintinj if sex=="F" *100% AAF - goes in the 100% AAF Injuries tab in the Excel spreadsheet *Ethanol and methanol toxicity, undetermined intent Y15 gen unkpoisonalcohol=. replace unkpoisonalcohol=1 if ICD10extcause=="Y15" tab unkpoisonalcohol if sex=="M" tab unkpoisonalcohol if sex=="F"