Hi, I'm working on a database describing medication reimbursement. My database looks like this : id refdate ATC reimb date 1ABC 2011-01-01 1 2011-02-01 1ABC 2011-01-01 1 2011-04-05 1ABC 2011-01-01 1 2011-06-17 2KHG 2011-04-03 5 2011-04-05 2KHG 2011-04-03 5 2011-05-03 2KHG 2011-04-03 5 2011-06-05 "id" stands for the identifier of my patients, "refdate" is a reference date, "ATC" is a medication class, "reimb date" stands for reimbursement dates. I'm trying to determine for each patient in my base, for periods of 60 days starting from their reference date, whether they did or did not receive a reimbursement of each "ATC" medication class in a given period of time. For example for the patient with the id "1ABC" I would like to obtain an array ATC1 with the values {1,1,1,0 ....}, an array ATC2 with the values {0,0,0,0 ....) etc. for each different ATC value I have. For the patient with the id "2KHG" I would like to obtain an array ATC1 with the values {0,0,0,0 ....}, an array ATC2 with the values {0,0,0,0 ....}, .... an array ATC5 with the values {1,1,1,0 ....) etc. For every patient I have an array containing the dates used to determine reimbursement status: I created an array "dates" with the values {refdate, refdate + 60, refdate + 120 ...} I have difficulties to loop on my patients ids, my "dates" array, the different ATC etc. I'm a beginner in SAS and more used to R "way of thinking". Thank you very much for your help. Yohann
... View more