Have you considered using a SAS macro variable to pass list of values? It can be a very efficient technique.Something like this:
proc sql noprint ;
select quote(variable_name) into :value_list separated by ' ' from libname.source_table ; /* quote() may not be needed */
quit ;
%put &value_list ; /* For checking */
Then query the other database:
select * from other_table where variable_name in ("&value_list") ;