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 all,

I am writing a very basic code but it shows as syntax error. Can you please let me know what is the error in the code as I think the code is correct. Thanks

Proc sql;
create table adding_repcode as 
select a.*,
b.rep_code
from Linked_for_CFOut as a
inner join p2scflow.debt as b on a.Account Number=b.debt_code;
quit;
Error log:
29         Proc sql;
30         create table adding_repcode as
31         select a.*,
32         b.rep_code
33         from Linked_for_CFOut as a
34         inner join p2scflow.debt as b on a.Account Number=b.debt_code;
                                                      ______
                                                      22
                                                      76
ERROR 22-322: Syntax error, expecting one of the following: !, !!, &, *, **, +, -, /, <, <=, <>, =, >, >=, AND, EQ, EQT, GE, GET, 
              GROUP, GT, GTT, HAVING, LE, LET, LT, LTT, NE, NET, OR, ORDER, WHERE, ^=, |, ||, ~=.  

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         quit;
NOTE: The SAS System stopped processing this step because of errors.
NOTE: PROCEDURE SQL used (Total process time):
      real time           0.00 seconds
      user cpu time       0.00 seconds
      system cpu time     0.00 seconds
      memory              337.90k
      OS Memory           32108.00k
      Timestamp           06/08/2023 04:22:52 PM
      Step Count                        36  Switch Count  0
1 ACCEPTED SOLUTION

Accepted Solutions
Kurt_Bremser
Super User

a.Account and Number are two different objects for the SQL interpreter, as they are separated by a blank.

If you actually made he mistake of creating a variable with a non-standard name, you have to use a name literal:

on a.'Account Number'n=b.debt_code

But you should go back to where this variable is created and make sure that an underline is used in place of the blank.

View solution in original post

2 REPLIES 2
Kurt_Bremser
Super User

a.Account and Number are two different objects for the SQL interpreter, as they are separated by a blank.

If you actually made he mistake of creating a variable with a non-standard name, you have to use a name literal:

on a.'Account Number'n=b.debt_code

But you should go back to where this variable is created and make sure that an underline is used in place of the blank.

Sandeep77
Lapis Lazuli | Level 10
Thank you.