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

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 16. Read more here about why you should contribute and what is in it for you!

Submit your idea!

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
  • 391 views
  • 1 like
  • 2 in conversation