Sometimes you need to merge in dose data with adverse events so you
know what dose a subject was on when they had the adverse event. This dose
data may have gaps with no dose and maybe overlaps for the stop date and
the following start date. How you handle overlaps may vary from compound
to compound. I wrote a macro for this because merrging on date ranges requires
a knowledge of SQL that not all programmers have. You can view the macro
below.
dosemerge
Do not use this macro blindly. You need to be aware that I am using
rules in the macro to handle overlaps that may not be correct for the drug
you are working on.
data dose;
subj=1;sdate='01jan2002'd;edate='05jan2002'd;dose=4;output; subj=1;sdate='07jan2002'd;edate='14jan2002'd;dose=6;output; subj=1;sdate='14jan2002'd;edate='21jan2002'd;dose=0;output; subj=2;sdate='14jan2002'd;edate='21jan2002'd;dose=5;output; format sdate edate date9.; run; data ae;
%dosemerge(dsin=ae,dsout=ae2,subject=subj,date=onset,
data _null_;
|
Some of the log output is shown below. Note that because of the way
the macro handles overlaps by reducing the stop date of the previous dose,
then subj=1 is assigned a zero dose for 14JAN2002.
18
19 data _null_; 20 set ae2; 21 put (_all_) (=); 22 run; subj=1 onset=14JAN2002 dose=0
|
Use the "Back" button of your browser to return to the previous page