Hi everyone, The study in this example was a double-blind study comparing 10, 20, and 30 mg of Drug X once daily vs Placebo. Study treatment was given as one tablet each from Bottles A, B, and C taken together once daily. The subject in this example took: • 1 tablet from Bottles A, B and C from 2011-01-14 to 2011-01-20 • 0 tablets from Bottle B on 2011-01-21, then 2 tablets on 2011-01-22 • 1 tablet from Bottles A and C on 2011-01-21 and 2011-01-22 • 1 tablet from Bottles A, B and C from 2011-01-23 to 2011-01-28 The EC dataset shows administrations as collected, in tablets. Upon unmasking, it became known that the subject was randomized to Drug X 20 mg and that: • Bottle A contained 10 mg/tablet. • Bottle B contained 10 mg/tablet. • Bottle C contained Placebo (i.e., 0 mg of active ingredient/tablet). The EX dataset shows the doses administered in the protocol-specified unit (mg). The sponsor considered an administration to consist of the total amount for Bottles A, B, and C. I was having trouble converting the core variable (ecdose) from EC dataset into the desired data structure in EX dataset. I've tried different approaches to obtain the sum of dosage for each non-overlapping time interval, but have failed to get the correct results. My code is shown below: data have;
input id $ ectrt $8. dose
ecstdtc yymmdd10. +1
ecendtc yymmdd10.
ecstdy ecendy;
format
ecstdtc yymmdd10.
ecendtc yymmdd10.;
datalines;
abc4001 BOTTLE A 1 2011-01-14 2011-01-28 1 15
abc4001 BOTTLE C 1 2011-01-14 2011-01-28 1 15
abc4001 BOTTLE B 1 2011-01-14 2011-01-20 1 7
abc4001 BOTTLE B . 2011-01-21 2011-01-21 8 8
abc4001 BOTTLE B 2 2011-01-22 2011-01-22 9 9
abc4001 BOTTLE B 1 2011-01-23 2011-01-28 10 10
;
run;
data have1;
set have;
if ectrt='BOTTLE A' then exdoseu=10;
else if ectrt='BOTTLE B' then exdoseu=10;
else if ectrt='BOTTLE C' then exdoseu=0;
exdose=exdoseu*dose;
if exdose=. then exdose=0;
run;
proc sql;
create table sum as
select a.id, a.ecstdtc,a.ecendtc,a.ecstdy,a.ecendy,
sum(b.exdose) as sum
from have1 as a,
have1 as b
where (a.id = b.id and b.ecendtc >= a.ecstdtc and b.ecendtc <= a.ecendtc)
group by a.id,
a.ecstdtc, a.ecendtc
;
quit; Any suggestions or ideas would be highly appreciated. Thank you so much in advance!!
... View more