data acct_id;
input acct_id $;
datalines;
001
002
; run;
data _null_;
set acct_id end = last;
length acct_list $1000.;
retain acct_list;
if _n_ = 1 then acct_list = "'"||trim(acct_id)||"'";
else acct_list = trim(acct_list)||",'"||trim(acct_id)||"'";
/*export the list to a macro variable*/
if last then call symput("acct_list", acct_list);run;
%put &acct_list;
proc sql;
connect to oracle (user=your_user_id password=your_password);
create table cust_data as
select * from connection to oracle
(
select *
from cust_db
where acct_id in (&acct_list.)
);
disconnect from oracle;
quit;