@Ivan555 the big table being in the DBMS, explains the long runtime, as all the rows have to be passed from the DBMS to SAS to then do the join.
Do avoid the transfer of all the rows from the DBMS to SAS, you have several possibilities:
copy the small table to the DBMS, so the join can be made within the DBMS, might no be an option depending on your rights
create the list of IDs using the Proc SQL select id into :idList separated by "," and use the macro var in the IN operator, similar to how you typed it in, but this time all automatic
If you have control over the LIBNAME statement pointing to the DBMS, have a look at the MULTI_DATASRC_OPT, it will do something similar, just all automatic
... View more