/***************************************************************************** PROGRAM: STROKE_APR94_MAR15.SAS TITLE: Defining the Occurrence of Stroke Related Events CREATED BY: Interdisciplinary Chronic Disease Collaboration (ICDC)/ Alberta Kidney Disease Network (AKDN), August 2015 Updated: Mar, 2016 ====================================================================== TERMS OF USE: This code was created by the ICDC/AKDN for its own use. Please be aware that the ICDC/AKDN DOES NOT: 1) Provide any guarantees about this code 2) Commit to the availability of any updates to the code 3) Support any implementation outside of the ICDC/AKDN Please use this code for information purposes only. ====================================================================== Goal: Identify people in the Alberta Health and Wellness (AHW) administrative data from April 1, 1994 to March 31, 2015 with codes for a stroke related event: acute ischemic stroke (AIS), intracerebral hemorrhage (ICH), subarachnoid hemorrhage (SAH), venous sinus/cortical vein thrombosis (CVT), or transient ischemic attack (TIA). ** NOTE *** Stroke is not a chronic disease in the same sense as diabetes or hypertension. Therefore, defining 'incident' or 'prevalent' cases is less relevant. The occurrence of a stroke related event is the most important. The program creates a dataset containing all occurrences of stroke related events, which can be used to define outcomes, or to define patients as having a 'history of' the condition. The data source from which the occurrences of stroke related events are obtained will impact the validity of the diagnosis. For example, using hospitalization data and the most responsible diagnosis for stroke related events will be the most valid. Using ACCS will likely result in misclassification (of TIA in particular). The most valid definition for stroke related events will be that defined by a hospitalization, using the most responsible diagnosis. Use this definition to define stroke related events as outcomes. The manner in which stroke related events are defined will depend on the study question. ICDC/AKDN Definition for AMI DATASETS: 1. Hospitalization Discharge Abstract Database (DAD), Apr. 1994 - Mar. 2015. Most responsible diagnosis (type='M') or where stroke-related event was a post-admission diagnosis (type='2') 2. Ambulatory Care Classification System (ACCS) Database, Apr. 1994 - Mar. 2015. Stroke related events coded as the most responsible diagnosis (type='M') from ER visits only. ER visits are defined by MIS codes 71310 (Emergency) or 7131020 (General Emergency). CODES: See documentation for stroke related events for ICD-9-CM and ICD-10-CA codes. HOSPITALIZATION TYPE: Most responsible diagnosis (type='M') or where stroke was a post-admission diagnosis (type='2') ACCS TYPE: Most responsible diagnosis (type='M') DATES TO BE USED: All available data. Hospitalization data is available from April 1, 1994 - March 31, 2015. Ambulatory care data is available from April 1, 1997 - March 31, 2015. USAGE NOTES (for this program): The STROKE_94_15_ALL dataset includes all records identified with codes for AIS, ICH, SAH, CVT or TIA from: 1) the hospitalizations using the most responsible diagnosis or coded as an in-hospital complication, and 2) from ER visits of the ACCS file using the most responsible diagnosis. There may be multiple records per patient if several stroke related events were experienced. The occurrence of a stroke related event is the most important. This dataset contains all occurrences of stroke related events identified from the hospitalizations or ACCS files, and can be used to define outcomes, or to define patients as having a 'history of' the condition. For each of the 5 stroke related events (AIS, ICH, SAH, CVT, TIA), there are: a flag for the condition; and diagnosis type (i.e. most responsible or in-hospital complication). The EVENT_DATE variable refers to the date of the hospitalization or ambulatory encounter on which the stroke related event was identified. The data source (ie. HOSP, ACCS) is indicated for each record in the dataset. To define records for individual conditions, use the flags for the conditions. For example, specifying AIS='1' identifies all hospitalizations or ambulatory encounters associated with an acute ischemic stroke. PHN is the unique identifier used to link the administrative data. ******************************************************************************/ option nofmterr nonumber mlogic helpbrowser=sas; * HELPBROWSER=SAS sets the SAS browser to default in the 64-bit OS --; * Location of the AHW administrative datasets (Hospitalizations, ACCS) --; libname ahw 'G:\IDENTIFIED\AHW\EXTRACTION_1994_2015\DATA\CleanDataCombined_2013_2015\DataCombined_2013_2015'; * Location to store the STROKE_94_15_ALL dataset --; libname stroke 'G:\IDENTIFIED\AHW\EXTRACTION_1994_2015\DATA\DERIVED_DATA\AHW_STROKE\DATA'; * Location of the demographics dataset created by the ICDC/AKDN. Includes information on gender, and dates of birth, death, and out-migration from Alberta --; libname demog 'G:\IDENTIFIED\AHW\EXTRACTION_1994_2015\DATA\DERIVED_DATA\AHW_DEMOGRAPHICS\DEMOGRAPHICS\DATA'; *********************************; * MACROS USED IN THIS PROGRAM -- ; *********************************; * MACRO for defining Fiscal Year from April 1994 - March 2015 --; %macro fy(in_t=,out_t=,date=); data &out_t; set &in_t; if not missing(&date) then do; if &date<='31MAR1994'd then FY='----/1994'; if '01APR1994'd<=&date<='31MAR1995'd then FY='1994/1995'; if '01APR1995'd<=&date<='31MAR1996'd then FY='1995/1996'; if '01APR1996'd<=&date<='31MAR1997'd then FY='1996/1997'; if '01APR1997'd<=&date<='31MAR1998'd then FY='1997/1998'; if '01APR1998'd<=&date<='31MAR1999'd then FY='1998/1999'; if '01APR1999'd<=&date<='31MAR2000'd then FY='1999/2000'; if '01APR2000'd<=&date<='31MAR2001'd then FY='2000/2001'; if '01APR2001'd<=&date<='31MAR2002'd then FY='2001/2002'; if '01APR2002'd<=&date<='31MAR2003'd then FY='2002/2003'; if '01APR2003'd<=&date<='31MAR2004'd then FY='2003/2004'; if '01APR2004'd<=&date<='31MAR2005'd then FY='2004/2005'; if '01APR2005'd<=&date<='31MAR2006'd then FY='2005/2006'; if '01APR2006'd<=&date<='31MAR2007'd then FY='2006/2007'; if '01APR2007'd<=&date<='31MAR2008'd then FY='2007/2008'; if '01APR2008'd<=&date<='31MAR2009'd then FY='2008/2009'; if '01APR2009'd<=&date<='31MAR2010'd then FY='2009/2010'; if '01APR2010'd<=&date<='31MAR2011'd then FY='2010/2011'; if '01APR2011'd<=&date<='31MAR2012'd then FY='2011/2012'; if '01APR2012'd<=&date<='31MAR2013'd then FY='2012/2013'; if '01APR2013'd<=&date<='31MAR2014'd then FY='2013/2014'; if '01APR2014'd<=&date<='31MAR2015'd then FY='2014/2015'; if '01APR2015'd<=&date then FY='2015/----'; end; COUNT=1; run; %mend fy; * MACRO for sorting by &var--; %macro srt(in_t=,out_t=,var=); proc sort data=&in_t out=&out_t; by &var; run; %mend srt; * MACRO to delete records in datasets occuring before dob and after death or outmigration --; * This macro uses the demographics dataset and SRT macro, defines the AGE variable, and produces * frequencies of records to be deleted. It also creates the &out_t2 dataset with the records deleted --; %macro demogcheck(in_t=,out_t1=,out_t2=,sourcedate=); data &out_t1; merge &in_t (in=in1) demog.ahw_demographics_2015 (in=in2); by phn; if in1; age=(&sourcedate-PERS_DOB)/365.25; if (PERS_DOB^=. and PERS_DOB>&sourcedate) or PERS_DOB=. then dobdelete=1; if death_date^=. and death_date<&sourcedate then deathdelete=1; if out_migrate_date^=. and out_migrate_date<&sourcedate then outdelete=1; if dobdelete=1 | deathdelete=1 | outdelete=1 then rec_delete=1; run; proc freq data=&out_t1; table dobdelete*deathdelete*outdelete*rec_delete/list missing; run; %srt(in_t=&out_t1,out_t=&out_t1,var=phn); data &out_t2; set &out_t1; if rec_delete=1 then delete; run; %mend demogcheck; * MACRO to count number of subjects --; %macro subjects(ds=); proc sort data=&ds out=subj_&ds nodupkey; by phn; run; %mend subjects; * MACRO to extract ICD9 codes from the HOSPITALIZATIONS datasets --; * The ICD9 codes from the hospitalizations database are available from 3 datasets covering * the fiscal years 1994-1997, 1997-1999, and 1999-2002. There are 16 fields for ICD9 * diagnosis codes.; %macro hosp_icd9(in_t=,out_t1=,out_t2=); data &out_t1; set &in_t(keep=PHN START_DATE SEPI_DX_MR_ICD9CM SEPI_DX_OTH_ICD9CM_1-SEPI_DX_OTH_ICD9CM_15 SEPIMRSP_DXTYP_HMRIDXTYP SEPI_DXTYP_OTH_HMRI_1-SEPI_DXTYP_OTH_HMRI_15); SOURCE='HOSP'; * Most responsible --; * AIS --; if substr(SEPI_DX_MR_ICD9CM,1,4)='3623' or (substr(SEPI_DX_MR_ICD9CM,1,3) in ('433','434') and substr(SEPI_DX_MR_ICD9CM,5,1)='1') or substr(SEPI_DX_MR_ICD9CM,1,3)='436' then do; AIS_MR='1'; AIS_CODE=SEPI_DX_MR_ICD9CM; AIS_TYPE='M'; end; * ICH --; if substr(SEPI_DX_MR_ICD9CM,1,3)='431' then do; ICH_MR='1'; ICH_CODE=SEPI_DX_MR_ICD9CM; ICH_TYPE='M'; end; * SAH --; if substr(SEPI_DX_MR_ICD9CM,1,3)='430' then do; SAH_MR='1'; SAH_CODE=SEPI_DX_MR_ICD9CM; SAH_TYPE='M'; end; * CVT --; if substr(SEPI_DX_MR_ICD9CM,1,3)='325' or substr(SEPI_DX_MR_ICD9CM,1,4)='4376' then do; CVT_MR='1'; CVT_CODE=SEPI_DX_MR_ICD9CM; CVT_TYPE='M'; end; * TIA --; if substr(SEPI_DX_MR_ICD9CM,1,3)='435' then do; TIA_MR='1'; TIA_CODE=SEPI_DX_MR_ICD9CM; TIA_TYPE='M'; end; * Post admission complication --; ARRAY diag_icd9_ (*) $ SEPI_DX_OTH_ICD9CM_1-SEPI_DX_OTH_ICD9CM_15; ARRAY type_icd9_ (*) $ SEPI_DXTYP_OTH_HMRI_1-SEPI_DXTYP_OTH_HMRI_15; ARRAY AIS_code_icd9_ (*) $ AIS_CODE2-AIS_CODE16; ARRAY ICH_code_icd9_ (*) $ ICH_CODE2-ICH_CODE16; ARRAY SAH_code_icd9_ (*) $ SAH_CODE2-SAH_CODE16; ARRAY CVT_code_icd9_ (*) $ CVT_CODE2-CVT_CODE16; ARRAY TIA_code_icd9_ (*) $ TIA_CODE2-TIA_CODE16; do i=1 to DIM(diag_icd9_); * AIS --; if (substr(diag_icd9_(i),1,4)='3623' and substr(type_icd9_(i),1,1)='2') or (substr(diag_icd9_(i),1,3) in ('433','434') and substr(diag_icd9_(i),5,1)='1' and substr(type_icd9_(i),1,1)='2') or (substr(diag_icd9_(i),1,3)='436' and substr(type_icd9_(i),1,1)='2') then do; AIS_OTH='1'; if AIS_CODE=' ' then AIS_CODE=diag_icd9_(i); ais_code_icd9_(i)=diag_icd9_(i); end; * ICH --; if substr(diag_icd9_(i),1,3)='431' and substr(type_icd9_(i),1,1)='2' then do; ICH_OTH='1'; if ICH_CODE=' ' then ICH_CODE=diag_icd9_(i); ich_code_icd9_(i)=diag_icd9_(i); end; * SAH --; if substr(diag_icd9_(i),1,3)='430' and substr(type_icd9_(i),1,1)='2' then do; SAH_OTH='1'; if SAH_CODE=' ' then SAH_CODE=diag_icd9_(i); sah_code_icd9_(i)=diag_icd9_(i); end; * CVT --; if (substr(diag_icd9_(i),1,3)='325' and substr(type_icd9_(i),1,1)='2') or (substr(diag_icd9_(i),1,4)='4376' and substr(type_icd9_(i),1,1)='2') then do; CVT_OTH='1'; if CVT_CODE=' ' then CVT_CODE=diag_icd9_(i); cvt_code_icd9_(i)=diag_icd9_(i); end; * TIA --; if substr(diag_icd9_(i),1,3)='435' and substr(type_icd9_(i),1,1)='2' then do; TIA_OTH='1'; if TIA_CODE=' ' then TIA_CODE=diag_icd9_(i); tia_code_icd9_(i)=diag_icd9_(i); end; end; if AIS_MR='1' or AIS_OTH='1' then AIS='1'; if missing(AIS_TYPE) and AIS='1' then AIS_TYPE='2'; if ICH_MR='1' or ICH_OTH='1' then ICH='1'; if missing(ICH_TYPE) and ICH='1' then ICH_TYPE='2'; if SAH_MR='1' or SAH_OTH='1' then SAH='1'; if missing(SAH_TYPE) and SAH='1' then SAH_TYPE='2'; if CVT_MR='1' or CVT_OTH='1' then CVT='1'; if missing(CVT_TYPE) and CVT='1' then CVT_TYPE='2'; if TIA_MR='1' or TIA_OTH='1' then TIA='1'; if missing(TIA_TYPE) and TIA='1' then TIA_TYPE='2'; drop i; run; data &out_t2; retain PHN START_DATE SOURCE AIS_MR AIS_OTH AIS AIS_TYPE ICH_MR ICH_OTH ICH ICH_TYPE SAH_MR SAH_OTH SAH SAH_TYPE CVT_MR CVT_OTH CVT CVT_TYPE TIA_MR TIA_OTH TIA TIA_TYPE ; set &out_t1; if AIS='1' | ICH='1' | SAH='1' | CVT='1' | TIA='1'; keep PHN START_DATE SOURCE AIS_MR AIS_OTH AIS AIS_TYPE ICH_MR ICH_OTH ICH ICH_TYPE SAH_MR SAH_OTH SAH SAH_TYPE CVT_MR CVT_OTH CVT CVT_TYPE TIA_MR TIA_OTH TIA TIA_TYPE ; run; %mend; * MACRO to extract ICD10 codes from the HOSPITALIZATIONS datasets --; * The ICD9 codes from the hospitalizations database are available from 1 dataset covering * the fiscal years 2002-2015. There are 25 fields for ICD10 diagnosis codes.; %macro hosp_icd10(in_t=,out_t1=,out_t2=); data &out_t1; set &in_t(keep=PHN START_DATE DX1-DX25 TYPE1-TYPE25); SOURCE='HOSP'; * Most responsible --; * AIS --; if substr(DX1,1,3) in ('I63','I64') or substr(DX1,1,4)='H341' then do; AIS_MR='1'; AIS_CODE=DX1; AIS_TYPE='M'; end; * ICH --; if substr(DX1,1,3)='I61' then do; ICH_MR='1'; ICH_CODE=DX1; ICH_TYPE='M'; end; * SAH --; if substr(DX1,1,3)='I60' then do; SAH_MR='1'; SAH_CODE=DX1; SAH_TYPE='M'; end; * CVT --; if substr(DX1,1,4) in ('I636','I677') or substr(DX1,1,3)='G08' then do; CVT_MR='1'; CVT_CODE=DX1; CVT_TYPE='M'; end; * TIA --; if substr(DX1,1,3)='G45' and substr(DX1,4,1)^='4' then do; TIA_MR='1'; TIA_CODE=DX1; TIA_TYPE='M'; end; * Post admission complication --; ARRAY diag_icd10_ (*) $ DX2-DX25; ARRAY type_icd10_ (*) $ TYPE2-TYPE25; ARRAY AIS_code_icd10_ (*) $ AIS_CODE2-AIS_CODE25; ARRAY ICH_code_icd10_ (*) $ ICH_CODE2-ICH_CODE25; ARRAY SAH_code_icd10_ (*) $ SAH_CODE2-SAH_CODE25; ARRAY CVT_code_icd10_ (*) $ CVT_CODE2-CVT_CODE25; ARRAY TIA_code_icd10_ (*) $ TIA_CODE2-TIA_CODE25; do i=1 to DIM(diag_icd10_); * AIS --; if (substr(diag_icd10_(i),1,3) in ('I63','I64') and substr(type_icd10_(i),1,1)='2')or (substr(diag_icd10_(i),1,4)='H341' and substr(type_icd10_(i),1,1)='2') then do; AIS_OTH='1'; if AIS_CODE=' ' then AIS_CODE=diag_icd10_(i); ais_code_icd10_(i)=diag_icd10_(i); end; * ICH --; if substr(diag_icd10_(i),1,3)='I61' and substr(type_icd10_(i),1,1)='2' then do; ICH_OTH='1'; if ICH_CODE=' ' then ICH_CODE=diag_icd10_(i); ich_code_icd10_(i)=diag_icd10_(i); end; * SAH --; if substr(diag_icd10_(i),1,3)='I60' and substr(type_icd10_(i),1,1)='2' then do; SAH_OTH='1'; if SAH_CODE=' ' then SAH_CODE=diag_icd10_(i); sah_code_icd10_(i)=diag_icd10_(i); end; * CVT --; if (substr(diag_icd10_(i),1,4) in ('I636','I677') and substr(type_icd10_(i),1,1)='2') or (substr(diag_icd10_(i),1,3)='G08' and substr(type_icd10_(i),1,1)='2') then do; CVT_OTH='1'; if CVT_CODE=' ' then CVT_CODE=diag_icd10_(i); cvt_code_icd10_(i)=diag_icd10_(i); end; * TIA --; if substr(diag_icd10_(i),1,3)='G45' and substr(diag_icd10_(i),4,1)^='4' and substr(type_icd10_(i),1,1)='2' then do; TIA_OTH='1'; if TIA_CODE=' ' then TIA_CODE=diag_icd10_(i); tia_code_icd10_(i)=diag_icd10_(i); end; end; if AIS_MR='1' or AIS_OTH='1' then AIS='1'; if missing(AIS_TYPE) and AIS='1' then AIS_TYPE='2'; if ICH_MR='1' or ICH_OTH='1' then ICH='1'; if missing(ICH_TYPE) and ICH='1' then ICH_TYPE='2'; if SAH_MR='1' or SAH_OTH='1' then SAH='1'; if missing(SAH_TYPE) and SAH='1' then SAH_TYPE='2'; if CVT_MR='1' or CVT_OTH='1' then CVT='1'; if missing(CVT_TYPE) and CVT='1' then CVT_TYPE='2'; if TIA_MR='1' or TIA_OTH='1' then TIA='1'; if missing(TIA_TYPE) and TIA='1' then TIA_TYPE='2'; drop i; run; data &out_t2; retain PHN START_DATE SOURCE AIS_MR AIS_OTH AIS AIS_TYPE ICH_MR ICH_OTH ICH ICH_TYPE SAH_MR SAH_OTH SAH SAH_TYPE CVT_MR CVT_OTH CVT CVT_TYPE TIA_MR TIA_OTH TIA TIA_TYPE ; set &out_t1; if AIS='1' | ICH='1' | SAH='1' | CVT='1' | TIA='1'; keep PHN START_DATE SOURCE AIS_MR AIS_OTH AIS AIS_TYPE ICH_MR ICH_OTH ICH ICH_TYPE SAH_MR SAH_OTH SAH SAH_TYPE CVT_MR CVT_OTH CVT CVT_TYPE TIA_MR TIA_OTH TIA TIA_TYPE ; run; %mend; * MACRO to extract ICD9 codes from the ACCS datasets --; * The ICD9 codes from the ACCS database are available from 3 datasets covering * the fiscal years 1994-1997, 1997-1999, and 1999-2002. Only the most responsible * diagnosis from ER visits is considered.; %macro accs_icd9(in_t=,out_t1=,out_t2=); data &out_t1; set &in_t(where=(REPI_FCENTR_MIS in ('71310','7131020')) keep=PHN START_DATE SEPI_DX_MR_ICD9CM REPI_FCENTR_MIS); SOURCE='ACCS'; * AIS --; if substr(SEPI_DX_MR_ICD9CM,1,4)='3623' or (substr(SEPI_DX_MR_ICD9CM,1,3) in ('433','434') and substr(SEPI_DX_MR_ICD9CM,5,1)='1') or substr(SEPI_DX_MR_ICD9CM,1,3)='436' then do; AIS='1'; AIS_CODE=SEPI_DX_MR_ICD9CM; AIS_TYPE='M'; end; * ICH --; if substr(SEPI_DX_MR_ICD9CM,1,3)='431' then do; ICH='1'; ICH_CODE=SEPI_DX_MR_ICD9CM; ICH_TYPE='M'; end; * SAH --; if substr(SEPI_DX_MR_ICD9CM,1,3)='430' then do; SAH='1'; SAH_CODE=SEPI_DX_MR_ICD9CM; SAH_TYPE='M'; end; * CVT --; if substr(SEPI_DX_MR_ICD9CM,1,3)='325' or substr(SEPI_DX_MR_ICD9CM,1,4)='4376' then do; CVT='1'; CVT_CODE=SEPI_DX_MR_ICD9CM; CVT_TYPE='M'; end; * TIA --; if substr(SEPI_DX_MR_ICD9CM,1,3)='435' then do; TIA='1'; TIA_CODE=SEPI_DX_MR_ICD9CM; TIA_TYPE='M'; end; run; data &out_t2; retain PHN START_DATE SOURCE AIS AIS_TYPE ICH ICH_TYPE SAH SAH_TYPE CVT CVT_TYPE TIA TIA_TYPE; set &out_t1; if AIS='1' | ICH='1' | SAH='1' | CVT='1' | TIA='1'; keep PHN START_DATE SOURCE AIS AIS_TYPE ICH ICH_TYPE SAH SAH_TYPE CVT CVT_TYPE TIA TIA_TYPE; run; %mend; * MACRO to extract ICD10 codes from the ACCS datasets --; * The ICD10 codes from the ACCS database are available from 1 dataset covering * the fiscal years 2002-2009. Only the most responsible * diagnosis from ER visits is considered.; %macro accs_icd10(in_t=,out_t1=,out_t2=); data &out_t1; set &in_t(where=(SEPI_MIS_ACCT_CODE in ('713100000','713102000')) keep=PHN START_DATE ICD1 SEPI_MIS_ACCT_CODE); SOURCE='ACCS'; * AIS --; if substr(ICD1,1,3) in ('I63','I64') or substr(ICD1,1,4)='H341' then do; AIS='1'; AIS_CODE=ICD1; AIS_TYPE='M'; end; * ICH --; if substr(ICD1,1,3)='I61' then do; ICH='1'; ICH_CODE=ICD1; ICH_TYPE='M'; end; * SAH --; if substr(ICD1,1,3)='I60' then do; SAH='1'; SAH_CODE=ICD1; SAH_TYPE='M'; end; * CVT --; if substr(ICD1,1,4) in ('I636','I677') or substr(ICD1,1,3)='G08' then do; CVT='1'; CVT_CODE=ICD1; CVT_TYPE='M'; end; * TIA --; if substr(ICD1,1,3)='G45' and substr(ICD1,4,1)^='4' then do; TIA='1'; TIA_CODE=ICD1; TIA_TYPE='M'; end; run; data &out_t2; retain PHN START_DATE SOURCE AIS AIS_TYPE ICH ICH_TYPE SAH SAH_TYPE CVT CVT_TYPE TIA TIA_TYPE; set &out_t1; if AIS='1' | ICH='1' | SAH='1' | CVT='1' | TIA='1'; keep PHN START_DATE SOURCE AIS AIS_TYPE ICH ICH_TYPE SAH SAH_TYPE CVT CVT_TYPE TIA TIA_TYPE; run; %mend; ***********************************; * Identify Stroke Related Events --; ***********************************; * 1) Create datasets with all records containing the relevant codes --; %hosp_icd9(in_t=ahw.hosp_94_97,out_t1=stroke._hosp_94_97,out_t2=stroke.hosp_94_97); %hosp_icd9(in_t=ahw.hosp_97_99,out_t1=stroke._hosp_97_99,out_t2=stroke.hosp_97_99); %hosp_icd9(in_t=ahw.hosp_99_02,out_t1=stroke._hosp_99_02,out_t2=stroke.hosp_99_02); %hosp_icd10(in_t=ahw.hosp_02_15,out_t1=stroke._hosp_02_15,out_t2=stroke.hosp_02_15); %accs_icd9(in_t=ahw.accs_97_02,out_t1=stroke._accs_97_02,out_t2=stroke.accs_97_02); %accs_icd10(in_t=ahw.accs_02_15,out_t1=stroke._accs_02_15,out_t2=stroke.accs_02_15); * 2) Combine data sources and sort by phn/start date --; data stroke1(drop=AIS_MR AIS_OTH ICH_MR ICH_OTH SAH_MR SAH_OTH CVT_MR CVT_OTH TIA_MR TIA_OTH); set stroke.hosp_94_97 stroke.hosp_97_99 stroke.hosp_99_02 stroke.hosp_02_15 stroke.accs_97_02 stroke.accs_02_15; run; %srt(in_t=stroke1,out_t=stroke1,var=phn start_date source); * Check patient numbers --; %subjects(ds=stroke1); * 3) Delete records after death date/out-migration date or before DOB --; %demogcheck(in_t=stroke1, out_t1=stroke2, out_t2=stroke3, sourcedate=start_date); * Check patient numbers --; %subjects(ds=stroke3); * 4) Save dataset with all hospitalizations and ACCS records for Stroke Related Events--; data stroke.stroke_94_15_ALL; retain PHN START_DATE SOURCE AIS AIS_TYPE ICH ICH_TYPE SAH SAH_TYPE CVT CVT_TYPE TIA TIA_TYPE; set stroke3(drop=death death_date out_migrate out_migrate_date PERS_GENDER_CODE PERS_DOB age dobdelete deathdelete outdelete rec_delete); rename START_DATE=EVENT_DATE; rename SOURCE=DATA_SOURCE; label START_DATE='Date of Stroke Related Event'; run; ***************************************************************************; * DESCRIPTIVE STATISTICS FOR THE STROKE RELATED EVENTS, STROKE_94_09_ALL --; ***************************************************************************; * Add Fiscal Year --; %fy(in_t=stroke.stroke_94_15_all,out_t=test,date=EVENT_DATE) data test2; set test; by phn EVENT_DATE; if first.phn then N_Subj=1; run; * Descriptives --; ods rtf file="G:\IDENTIFIED\AHW\EXTRACTION_1994_2015\DATA\DERIVED_DATA\AHW_STROKE\OUTPUT\stroke_cohortsummary.rtf" bodytitle; title1 "PROC CONTENTS: STROKE_94_15_ALL"; proc contents data=stroke.stroke_94_15_all varnum; run; title1; title1 'Number of Subjects in Stroke Related Events Dataset'; proc freq data=test2(where=(n_subj=1)); table N_subj; run; title1; title1 'Number of Records in Stroke Related Events Dataset'; proc freq data=test; table count; run; title1; title1 'Number of Records in Stroke Related Events Dataset by Data Source (HOSP or ACCS)'; proc freq data=test; table data_source; run; title1; title1 'Number of Records in Stroke Related Events Dataset by Fiscal Year'; proc freq data=test; table fy/out=testa; run; title1; title1 'Number of Records in Stroke Related Events Dataset by Data Source by Fiscal Year'; proc freq data=test; table data_source*fy/out=testb; run; title1; title1 "Graph: Number of Records in Stroke Related Events Dataset by Fiscal Year"; proc gplot data=testa; plot count*fy/ vaxis=0 TO 15000 BY 500; symbol i=join v=circle c=black; label count="Number of Stroke Related Events"; label fy="Fiscal Year"; run; quit; title1 "Graph: Number of Records in Stroke Related Events Dataset by Data Source by Fiscal Year"; proc gplot data=testb; plot count*fy=data_source/ vaxis=0 TO 15000 BY 500; symbol1 i=join v=circle c=black; symbol2 i=join v=square c=blue; label count="Number of Stroke Related Events"; label fy="Fiscal Year"; run; quit; title1 "Combinations of AIS, ICH, SAH, CVT, and TIA"; proc freq data=test; table ais*ich*sah*cvt*tia/list missing; run; title1; * Create Graphs by Condition (AIS, ICH, SAH, CVT, or TIA)--; %macro strokdes(in_t=,cond=); title1 "Number of &cond Records in Stroke Related Events Dataset"; proc freq data=test(where=(&cond='1')); table &cond/list missing; run; title1 "Number of &cond Records in Stroke Related Events Dataset by Fiscal Year"; proc freq data=test(where=(&cond='1')); table fy/list missing out=a_&cond; run; title1 "Number of &cond Records in Stroke Related Events Data Set by Data Source"; proc freq data=test(where=(&cond='1')); table data_source/list missing; run; title1 "Number of &cond Records in Stroke Related Events Dataset by Data Source by Fiscal Year"; proc freq data=test(where=(&cond='1')); table data_source*fy/list missing out=b_&cond; run; title1 "Graph: Number of &cond Records in Stroke Related Events Dataset by Fiscal Year"; proc gplot data=a_&cond; plot count*fy/ vaxis=0 TO 8000 BY 500; symbol i=join v=circle c=black; label count="Number of &cond Records"; label fy="Fiscal Year"; run; quit; title1 "Graph: Number of &cond Records in Stroke Related Events Dataset by Data Source by Fiscal Year"; proc gplot data=b_&cond; plot count*fy=data_source/ vaxis=0 TO 8000 BY 500; symbol1 i=join v=circle c=black; symbol2 i=join v=square c=blue; label count="Number of &cond Records"; label fy="Fiscal Year"; run; quit; %mend; %strokdes(in_t=test,cond=AIS); %strokdes(in_t=test,cond=ICH); %strokdes(in_t=test,cond=SAH); %strokdes(in_t=test,cond=CVT); %strokdes(in_t=test,cond=TIA); ods rtf close; *******************; * END OF PROGRAM --; *******************;