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
It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.
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.