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 .
Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!
What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.