Hi, I have a list of patients and whether and when they filled a diabetes drug, had an hospitalization claim for diabetes, and/or had a outpatient diagnosis for diabetes (DiabetesOutcome=1). Having trouble with multiple dates. ENROLID = person id Drug: DMDrug = Diabetes drug (0= no diabetes drug, 1= filled diabetes drug) DMDrugDate1-DMDrugDate52 = all fill dates for diabetic drug Hospital InptPrimDMDx = Primary hospital diagnosis for diabetes (0= Yes, 1= No) InptSecDMDx = Secondary hospital diagnosis for diabetes (0= Yes, 1= No) InptPrimDMDx_Date1 to InptPrimDMDx_Date9 = all dates of hospitalization with primary diagnosis of diabetes InptSecDMDx_Date1 to InptSecDMDx_Date4 = all dates of hospitalization with secondary diagnosis of diabetes Doctor office visits OutptDMDx= Office visit with diabetes diagnosis (0= Yes, 1= No) OutptDMDate_1 to OutptDMDate_38 = all dates for office visit with diabetes diagnosis My decision rules for actual DiabetesOutcome1: If InptPrimDMDx = 1 then DiabetesOutcome = 1 OR If DMDrug =1 AND If DMDrugDate within +/- 120 days of InptSecDMDx_Date OR within +/- 120 days off OutptDMDate then DiabetesOutcome = 1; OR If InptSecDMDx =1 AND if InptSecDMDx_Date within +/- 120 days of DMDrugDate OR within +/- 120 days of OutptDMDate then DiabetesOutcome = 1 OR If OutptDMDx=1 AND if OutptDMDate within +/- 120 days of DMDrugDate OR within +/- 120 days of InptSecDMDx then DiabetesOutcome = 1 Then the first date that drug was filled, or inpatient/outpatient claim would be the date of DiabetesOutcome =1 Dataset looks somethin like this: ENROLID InptPrimDx InptSecDMDx InptSecDMDx InptSecDMDxDate1.... InptSecDMDxDate38 DMDrug DMDrugDate1...52 1 1 5/1/15 1 6/15/15 7/15/15 1 5/4/15 2 0 . 0 Any help is greatly appreciated. Thank you .
... View more