If you have a many to many join, you can't use a merge statement. A merge doesn't actually join tables together like SQL does so you end up with unexpected results if you have a many to many join. You'll need to use proc sql. proc sql; create table New6 as select N.*, S.wanted_field1, S.wanted_fiedl2 from New6 as N, schduling_data3 as S where N.provider = S.provider and N.start_date between S.start_date and S.end_date; quit; This presupposes that you have an end date and that the provider time periods do not overlap between provider records. If not, you will end up with duplicate rows and you will need to make a determination of which provider row is the correct one. You may be able to do that in the proc sql step or you may want to sort your data and select it out using a data step.
... View more