DATA Step, Macro, Functions and more

Syntax error

Reply
New Contributor
Posts: 3

Syntax error

Hey,

Is anyone able to help me with the below, I'm sure the answer is glaring me in the face but I just can't seem to figure it out..

 

 


15 proc sql;
16 create table UBIF_Impacted_Flag as
17 select t1.Ledger as client_ID
18 ,t1.name
19 ,t1.Status_Update as Status,
20 ,t1.Final_Population Result as 'Impacted_Flag'
_ ______
22 202
ERROR 22-322: Syntax error, expecting one of the following: a name, a quoted string, a numeric constant, a datetime constant,
a missing value, *, BTRIM, INPUT, PUT, SUBSTRING, USER.

ERROR 202-322: The option or parameter is not recognized and will be ignored.

20 ! ,t1.Final_Population Result as 'Impacted_Flag'
______
22
ERROR 22-322: Syntax error, expecting one of the following: a quoted string, !, !!, &, *, **, +, ',', -, /, <, <=, <>, =, >, >=, ?,
AND, AS, BETWEEN, CONTAINS, EQ, EQT, FORMAT, FROM, GE, GET, GT, GTT, IN, INFORMAT, INTO, IS, LABEL, LE, LEN, LENGTH,
LET, LIKE, LT, LTT, NE, NET, NOT, NOTIN, OR, TRANSCODE, ^, ^=, |, ||, ~, ~=.

21 ,t1.FF_Candidate
22 ,t1.Relationship_Manager
23 from egtask.UBIF_Impacted_Population_FINAL t1
24 ;
NOTE: PROC SQL set option NOEXEC and will continue to check the syntax of statements.
25 quit;
NOTE: The SAS System stopped processing this step because of errors.
NOTE: PROCEDURE SQL used (Total process time):
real time 0.00 seconds
cpu time 0.00 seconds

26
27 GOPTIONS NOACCESSIBLE;
28 %LET _CLIENTTASKLABEL=;
29 %LET _CLIENTPROJECTPATH=;
30 %LET _CLIENTPROJECTNAME=;
2 The SAS System 10:16 Monday, July 2, 2018

31 %LET _SASPROGRAMFILE=;
32
33 ;*';*";*/;quit;run;
34 ODS _ALL_ CLOSE;
35
36
37 QUIT; RUN;
38

 

Thanks

Super User
Posts: 6,775

Re: Syntax error

Yes, sorry to say but it is staring you in the face.  You have an extra comma at the end of the preceding line.

New Contributor
Posts: 3

Re: Syntax error

Posted in reply to Astounding

I removed the comma but same error

 

 

 

15 proc sql;
16 create table UBIF_Impacted_Flag as
17 select t1.Ledger as client_ID
18 ,t1.name
19 ,t1.Status_Update as Status
20 ,t1.Final_Population Result as 'Impacted_Flag'
______
22
202
ERROR 22-322: Syntax error, expecting one of the following: a quoted string, !, !!, &, *, **, +, ',', -, /, <, <=, <>, =, >, >=, ?,
AND, AS, BETWEEN, CONTAINS, EQ, EQT, FORMAT, FROM, GE, GET, GT, GTT, IN, INFORMAT, INTO, IS, LABEL, LE, LEN, LENGTH,
LET, LIKE, LT, LTT, NE, NET, NOT, NOTIN, OR, TRANSCODE, ^, ^=, |, ||, ~, ~=.

ERROR 202-322: The option or parameter is not recognized and will be ignored.

21 ,t1.FF_Candidate
22 ,t1.Relationship_Manager
23 from egtask.UBIF_Impacted_Population_FINAL t1

Super User
Posts: 6,775

Re: Syntax error

Yes, finding the first error often reveals the next one.

 

What is the name of the field you are trying to bring in?

 

Do you really have a field with an embedded blank in the name:  Final_Population Result

 

I believe that the "as" keyword forces you to select a field name, so you wouldn't need quotes around "Impacted_Flag"

New Contributor
Posts: 3

Re: Syntax error

Posted in reply to Astounding

Hey, thanks for pointing the name out it work once I put it in as t1.Final_Population_Result as Impacted_Flag, cheers for your help

Respected Advisor
Posts: 3,018

Re: Syntax error

From now on, could you please help us all out by posting SASLOGs in the window that appears after you click on the {i} icon? Thank you.

--
Paige Miller
Ask a Question
Discussion stats
  • 5 replies
  • 85 views
  • 0 likes
  • 3 in conversation