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.

SAS INNOVATE 2024

Innovate_SAS_Blue.png

Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.

If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website. 

Register now!

From SAS Users blog
Want more? Visit our blog for more articles like these.
5 Steps to Your First Analytics Project Using SAS

For SAS newbies, this video is a great way to get started. James Harroun walks through the process using SAS Studio for SAS OnDemand for Academics, but the same steps apply to any analytics project.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 2 replies
  • 2044 views
  • 1 like
  • 2 in conversation