Hi Team,
Kindly let me know how to create sql not in sub query in SAS DI Studio.
For example we have table A ( with Saving A/C) and Table B ( Loan A/C with Saving A/C) and we want to create a table which have account numbers containing only saving A/C.
Table A | Table B | Table C |
121 | 123 | 121 |
122 | 126 | 122 |
123 | 128 | 125 |
124 | 124 | 127 |
125 | 120 | 129 |
126 | ||
127 | ||
128 | ||
129 | ||
120 |
Query need to develop :
Create table C as Select * from A where ID not in ( select ID from B);
I have already tried with sql join transformation which includes sub-query in join condition with NOT IN but due to join (Inner join), It is providing Cartesian product.
Kindly suggest any other way or am i missing something.
Regards,
Uma Shanker Saini
proc sql;
create table_c as
select * from table_a
where (cust not in (select cust from table_b));
quit;
Hi Shmuel,
Thanks for your quick reply but have you read the question properly ??
If you are unable to understand the question then please let me know i could explain in more lay man language.
Regards,
Uma Shanker Saini
Please post your log. I cannot imagine cartesian join with sub-query of ID NOT IN table_B
even if ID is not unique key in the table.
May be there is another issue.
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
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.