BookmarkSubscribeRSS Feed
mcgrant1
Calcite | Level 5

Hello guys, I am quite new to SAS programming, so I am writing this sql sub query in SAS 9.4, and came across error 22-322, below are the logs, thank you all for the help! 

 

 

 

146  proc sql;
147  create table work.ALM_BAD_NUMBERS  as
148  select
149  S.LOCCODE,
150  D._ACCOUNT,
151  D._NUMBER,
152  D._NUMBER2,
153  D._NUMBER1,
154  D._NUMBER3,
155  D._LISTNAME,
156  mdy(input(substr(S.STEBTDT,1,2),2.),input(substr(S.STEBTDT,4,2),2.),2000+input(substr(S.STEBT
156! DT,7,2),2.)) as STENTDT,
157  mdy(input(substr(S.LASTCNCTDTE,1,2),2.),input(substr(S.LASTCNCTDTE,4,2),2.),2000+input(substr
157! (S.LASTCNCTDTE,7,2),2.)) as LASTCNCTDTE,
158
159
160  from
161  Alm.cl_PP_ALL_dynamic as D
     ---
     22
ERROR 22-322: Syntax error, expecting one of the following: !, !!, &, (, *, **, +, ',', -, /, <,
              <=, <>, =, >, >=, ?, AND, BETWEEN, CONTAINS, EQ, EQT, FROM, GE, GET, GT, GTT, LE,
              LET, LIKE, LT, LTT, NE, NET, OR, ^=, |, ||, ~=.

162  LEFT JOIN
     ----
     22
     76
ERROR 22-322: Syntax error, expecting one of the following: a quoted string, ',', AS, FORMAT,
              FROM, INFORMAT, INTO, LABEL, LEN, LENGTH, TRANSCODE.

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

163  Alm.cl_PP_ALL_static as S
164  ON
165  D.contact_record_id = S.contact_record_id
166  ;
167  quit;

1 REPLY 1
PaigeMiller
Diamond | Level 26

Line 157 ... remove the comma at the end

--
Paige Miller

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
  • 1 reply
  • 6430 views
  • 2 likes
  • 2 in conversation