I'm working on a medication data set with overlapped period and daily dose for each record data test;
infile datalines delimiter = ',';
input solddt: date9. rxsup dose med_end_dt: date9. cluster ;
format solddt yymmdd10. med_end_dt yymmdd10.;
datalines;
10sep2009, 16, 200, 26sep2009, 1
02oct2009, 2, 45, 04oct2009, 1
06oct2009, 66, 90.91, 11dec2009, 1
12oct2009, 16, 200, 28oct2009, 1
21oct2009, 12, 62.5, 02nov2009, 1
03nov2009, 33, 181.82, 06dec2009, 1
12nov2009, 2, 45, 14nov2009, 1
12nov2009, 16, 200, 28nov2009, 1
04dec2009, 33, 181.82, 06jan2010, 1
14dec2009, 25, 128, 08jan2010, 1
17dec2009, 2, 45, 09dec2009, 1
15jan2010, 5, 45, 20jan2010, 2
18feb2010, 25, 90, 15mar2010, 3
;
run; How would you implement a new variable newdailydose which is the sum of daily dose during the overlapped periods after the records are separated? Also, please explain how x is concatenated with n and x in the do loop in your code
... View more