04-20-2015 06:41 PM
Hi, I have data like this (all of the dates are in SAS date format):
|1||Jan 1 2010||June 30 2010||Jan 1 2009||Feb 1 2010||.||.|
|2||Jan 1 2011||Jan 30 2011||Jan 1 2012||June 1 2012||Jan 1 2013||.|
|3||Jan 1 2012||June 30 2012||Jan 1 2013||June 1 2013||June 1 2013||.|
I'm interested in finding the shortest interval between any of the diagnosis dates and any of the Rx fill dates OR procedure dates. I want to identify everyone who had an Rx or procedure 6 months AFTER a diagnosis and I don't care whether it was the first diagnosis or not (for example, patient 1 had a prescription fill date on Feb 1, 2010, a month after their Jan 1, 2010 diagnosis, so I would like to flag them for inclusion. Patient 2 did not have any prescriptions or procedures within 6 months of either diagnosis date, so I don't want to include him). Some people have 20+ diagnosis dates and 20+ Rx and procedure dates, so it's not very efficient to calculate the differences between all those dates by hand. Is there code I can use to calculate the differences between all of the diagnosis dates and each of the RxfillDates and ProcedureDates? Then, once the differences in dates have been calculated, I could identify everyone who at least one date differences of 180 days or less for inclusion in my analysis?
Thanks so much in advance.
04-21-2015 05:40 PM
Can you be more specific? Here's what I've tried:
*These are variables I have;
ARRAY DXDATE (175) DIAGNOSISDATE1-DIAGNOSISDATE175;
ARRAY PROCEDUREDATE (23) PROCEDUREDATE1-PROCEDUREDATE23;
*this is a new variable I'm creating, figuring at most there are 175*23=4025 different intervals between diagnosis and procedures;
array procduredays(4025) procduredays1-procduredays4025;
DO i=1 TO 4025 ;
I know the last 4 lines of code are incorrect but I'm hoping they clarify what I'm trying to calculate: all the (up to 4025) different time intervals between each of the diagnosis dates and each of the procedure dates. Then I want to choose the smallest time interval from those.
Thanks again for any help.