Hi, I have one main table with keys and I want to check if those keys exists in other tables. Example: MAIN TABLE keys
----
1
2
3 OTHERS (85 tables) TABLE 1 key date
--- ----------
1 2020/01/01 TABLE 2 key date
--- ---------
2 2020/01/02 3 2020/01/02 TABLE 3 key date
--- ---------
1 2020/01/03 3 2020/01/03 etc... With 3 tables was ok. I did: PROC SQL;
CREATE TABLE WORK.QUERY_FOR_DATA AS
SELECT t1.A,
t2.B,
t3.B AS B1,
t4.B AS B2
FROM WORK.DATA t1
LEFT JOIN WORK.TB1 t2 ON (t1.A = t2.A)
LEFT JOIN WORK.TB2 t3 ON (t1.A = t3.A)
LEFT JOIN WORK.TB3 t4 ON (t1.A = t4.A);
QUIT; RESULT A B B1 B2
--- ---------- ---------- ----------
1 2020/01/01 2020/01/03 2 2020/01/02 3 2020/01/02 2020/01/03 The problem here it's 85 tables that I need to do that and 7 millions keys! So 85 columns with 7 millions rows. And I'm getting space error. Is there a better approach to do this? Also is it possible to make the header as that date and fill with 1 or 0. For example: EXPECTED
A 2020/01/01 2020/01/03 2020/01/02
--- ---------- ---------- ----------
1 1 1
2 1
3 1 1 Thank you.
... View more