Hi Lawrence,
Try the following:
data temp;
input Visitno Room Bed InDate & $20.;
datalines;
1234 1 1 JAN 1, 2011
1234 1 1 JAN 2, 2011
1234 5 2 JAN 3, 2011
1234 5 2 JAN 4, 2011
1234 5 2 JAN 5, 2011
1234 5 2 JAN 10, 2011
1234 1 1 JAN 11, 2011
1234 1 1 JAN 12, 2011
;
data first last;
set temp;
by room bed indate notsorted;
if first.room = last.room then delete;
if first.room then output first;
if last.room then output last;
run;
data x;
merge first last(keep = indate rename=(indate = lastdate));
run;
Thanks,
Amar Mundankar.
... View more