BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
Sandeep77
Lapis Lazuli | Level 10

Hello Expert,

Just created a code to find some information but I am getting syntax error. Not sure what I am missing in my code. Can you please check and let me know what's the error in my code?

proc sql;
create table Non_UK_address as
select a.*,
b.dr_postcode
from trace_nonlit as a
inner join p2scflow.debtor as b on on A.debt_code = B.debt_code
Where
(b.dr_postcode like '%IM%' or b.dr_postcode like '%JE%' or b.dr_postcode like '%GY%');
quit;

Error:

29         proc sql;
30         create table Non_UK_address as
31         select a.*,
32         b.dr_postcode
33         from trace_nonlit as a
34         inner join p2scflow.debtor as b on on A.debt_code = B.debt_code
                                                 _
                                                 22
                                                 76
ERROR 22-322: Syntax error, expecting one of the following: !, !!, &, (, *, **, +, ',', -, /, <, <=, <>, =, >, >=, ?, AND, BETWEEN, 
              CONTAINS, EQ, EQT, GE, GET, GROUP, GT, GTT, HAVING, JOIN, LE, LET, LIKE, LT, LTT, NE, NET, OR, ORDER, WHERE, ^=, |, 
              ||, ~=.  

ERROR 76-322: Syntax error, statement will be ignored.

35         Where
36         (b.dr_postcode like '%IM%' or b.dr_postcode like '%JE%' or b.dr_postcode like '%GY%');
NOTE: PROC SQL set option NOEXEC and will continue to check the syntax of statements.
37         quit;
1 ACCEPTED SOLUTION

Accepted Solutions
PeterClemmensen
Tourmaline | Level 20

Simple. You have two on keywords 🙂

View solution in original post

3 REPLIES 3
PeterClemmensen
Tourmaline | Level 20

Simple. You have two on keywords 🙂

Sandeep77
Lapis Lazuli | Level 10
Thank you 😄
PeterClemmensen
Tourmaline | Level 20

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
Mastering the WHERE Clause in PROC SQL

SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 3 replies
  • 328 views
  • 1 like
  • 2 in conversation