proc sql;
create table want as select
data2.*
,case when data2.age between data1.age_1 and data1.age_2 then 1 else 0 end as flag
from data1 left join data2
on upcase(data1.name)=upcase(data2.name);
quit;
This code is untested, you need to provide data as working SAS data step code for it to be tested.
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.