Your assignment is easy. I think I will be blamed by Art.T . data testing;
input subject dose startmonth endmonth;
cards;
1 25 0 3
1 25 3 5
1 50 5 7
1 50 7 9
1 50 9 12
1 . 12 14
1 25 14 16
2 50 0 3
2 50 3 5
2 25 5 7
2 25 7 9
2 50 9 12
2 . 12 14
2 . 14 16
;
run;
data x(keep=subject dose duration);
set testing;
by subject dose notsorted;
retain start;
if first.dose then start=startmonth;
if last.dose then do;duration=endmonth-start;output;end;
run;
data want(keep=subject pattern time);
set x;
by subject notsorted;
length pattern time $ 400;
retain pattern time;
pattern=catx('#',pattern,dose);
time=catx('#',time,duration);
if last.subject then do;output;call missing(pattern,time);end;
run;
Ksharp
... View more