proc sql; create table temp as select a.*,b.Machine as b_Machine,b.date as b_date from a,b where a.Machine=b.Machine and b.date gt a.date group by a.Machine having b.date-a.date=min(b.date-a.date); create table want as select temp.*,c.date as c_date, case when c.date between temp.date and temp.b_date then 'yes' else 'no ' end as flag from temp left join c on temp.Machine=c.Machine ; quit; My want table has a where statement where the c_date Falls between temp date and temp date ....but it's not it's bringing in every instance from c table ...I don't need every instance from c only if it falls between those 2 dates an if not than blank..thanks
... View more