Hello,
I try to insert in TableB all items from TableA which are not appear in TableB.
PROC SQL;
INSERT INTO SERVER.TABLEB (GRVID)
SELECT VTGONR
FROM SERVER.TABLEA
WHERE not in (SELECT GRVID FROM SERVER.TABLEB);
QUIT;
But if I run this code, I get Always an error.
The field GRVID is underlined and I get following error text:
ERROR 22-322: Syntax error, expecting one of the following: !, !!, &, (, ), *, **, +, ',', -, '.', /, <, <=, <>, =, >, >=, ?, AND,
BETWEEN, CONTAINS, EQ, EQT, GE, GET, GT, GTT, IN, IS, LE, LET, LIKE, LT, LTT, NE, NET, NOT, NOTIN, OR, ^, ^=, |, ||,
~, ~=.ERROR 202-322: The option or parameter is not recognized and will be ignored.
If I run the code without the WHERE clause it works, but if I add the WHERE clause I get the error.
Thanks,
Sascha
PROC SQL;
INSERT INTO SERVER.TABLEB (GRVID)
SELECT VTGONR
FROM SERVER.TABLEA
WHERE VTGONR not in (SELECT GRVID FROM SERVER.TABLEB);
QUIT;
Mention the Key variable before NOT IN
PROC SQL;
INSERT INTO SERVER.TABLEB (GRVID)
SELECT VTGONR
FROM SERVER.TABLEA
WHERE VTGONR not in (SELECT GRVID FROM SERVER.TABLEB);
QUIT;
Mention the Key variable before NOT IN
Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.