/* PROC SQL Method                       */

proc sql;
   create table lab as
   select a.*, b.start, b.stop, b.drug from
   lab a left join drug b
   on a.patid eq b.patid and
      a.labdate ge b.start and
      a.labdate le b.stop
   order by patid,labdate;
quit;