Show us the complete (all of it, every single line) LOG of both programs. (Which one did you run first?)
Please copy the LOG as text and paste it into the window that appears when you click on the </> icon here in the SAS Communities.
So you created a SAS dataset and then asked DB2 to read from it? That cannot work.
If you want your DB2 code to access data you need to move the data into DB2.
How many ids are in the WORK table? If the list is small enough you might be able to use a macro variable to build your WHERE condition.
Do you want all of the values from the DB2 table for the ID's in your WORK table?
proc sql noprint;
select distinct ID into :list seprated by ',' from work.table2;
CONNECT TO db2(login stuff);
CREATE TABLE table3 as
SELECT * from connection to db2
(SELECT B.*
FROM schema.db2table b
where b.id in (&list)
)
;
quit;
If the ID variable is character instead of numeric then change select distinct id into to select distinct quote(trim(id),"'") into .
If you just want the list of matching ids then change SELECT B.* to select distinct b.id .
It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.
Check out this tutorial series to learn how to build your own steps in SAS Studio.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.