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

Hi Expert, 

I am not sure about the syntax error. I think my code is correct but getting error.


proc sql;
create table Chase_Linked as
	select distinct *
		from Address_Check
			where accountstatus = 'Campaign','Chase','Chase Hold','Paying';

create table Chase_Linked2 as
	select distinct *,
					sum(Postcode_Check) as Acc_Check,
					count(debt_code) as Linked_Count
		from Chase_Linked
			group by icustomerid;

create table Chase_Linked3 as 
	select distinct *,
		case when sum(Acc_Check) = sum(Linked_Count) then 'Y' else 'N'
			end as Cust_Check
				from Chase_Linked2
					group by icustomerid;

create table Trace_Chase_Linked as
	select distinct(Trace_Acc),
					Trace_Rep,
					Trace_Status
		from Chase_Linked3
			where Cust_Check = 'Y';
quit;

Error log:

30         proc sql;
31         create table Chase_Linked as
32         	select distinct *
33         		from Address_Check
34         			where accountstatus = 'Campaign','Chase','Chase Hold','Paying';
                                              _
                                              22
                                              76
ERROR 22-322: Syntax error, expecting one of the following: ;, !, !!, &, *, **, +, -, /, <, <=, <>, =, >, >=, AND, EQ, EQT, EXCEPT, 
              GE, GET, GROUP, GT, GTT, HAVING, INTERSECT, LE, LET, LT, LTT, NE, NET, NOT, OR, ORDER, OUTER, UNION, ^, ^=, |, ||, ~, 
              ~=.  

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

NOTE: PROC SQL set option NOEXEC and will continue to check the syntax of statements.
35         
36         create table Chase_Linked2 as
37         	select distinct *,
38         					sum(Postcode_Check) as Acc_Check,
39         					count(debt_code) as Linked_Count
40         		from Chase_Linked
41         			group by icustomerid;
NOTE: Statement not executed due to NOEXEC option.

Can you please check the code and error log to find it?

1 ACCEPTED SOLUTION
4 REPLIES 4
Sandeep77
Lapis Lazuli | Level 10

Thank you for your response and I did the way you suggested but still getting this error.

30         proc sql;
31         create table Chase_Linked as
32         	select distinct *
33         		from Address_Check
34         			where accountstatus in 'Campaign','Chase','Chase Hold','Paying';
                                     __________                              _
                                     22                                      79
ERROR 22-322: Syntax error, expecting one of the following: (, SELECT.  

ERROR 79-322: Expecting a ).

NOTE: PROC SQL set option NOEXEC and will continue to check the syntax of statements.
Kurt_Bremser
Super User

Look at the code I gave you and pay attention to details. It is obvious from the ERROR message you got, the message literally tells you what's missing.

Sandeep77
Lapis Lazuli | Level 10
Thank you. I found it. That was great help 🙂

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
  • 4 replies
  • 440 views
  • 2 likes
  • 2 in conversation