Desktop productivity for business analysts and programmers

syntax error

Accepted Solution Solved
Reply
Occasional Contributor
Posts: 19
Accepted Solution

syntax error

Hello

 

I am getting this error and cant seem to figure out what is going on

 

Thanks

 

Rida

 

 

 

WARNING: Apparent symbolic reference THRU_ALL not resolved.
NOTE 137-205: Line generated by the invoked macro "QTRLY_SUMS".
809         PROC APPEND BASE=rptlib.qrtly_sum_totals1 DATA=in_b FORCE; RUN;    PROC SQL;    CREATE TABLE rptlib.qrtly_sum_totals AS
809      !    SELECT     *     ,&thru_all.    FROM rptlib.qrtly_sum_totals1   ;QUIT;
                                                   ______
                                                   22
ERROR 22-322: Syntax error, expecting one of the following: a name, a quoted string, a numeric constant, a datetime constant,


Accepted Solutions
Solution
‎04-20-2017 10:00 AM
Super User
Super User
Posts: 6,383

Re: syntax error

If it is undefined then it will still generate a syntax error. It will just leave the macro reference as it was and the this: 

select * &thru_all.

Is not valid syntax.

View solution in original post


All Replies
Esteemed Advisor
Posts: 7,300

Re: syntax error

What is the macro variable &thru_all and is it even needed. By using select * you are already selecting all of the dataset's variables.

 

Art, CEO, AnalystFinder.com

 

Esteemed Advisor
Posts: 5,202

Re: syntax error

Well, it could be a constant that should be added to the result.

Either way, it's not assigned at the execution time for this query.

Data never sleeps
Esteemed Advisor
Esteemed Advisor
Posts: 7,253

Re: syntax error

WARNING: Apparent symbolic reference THRU_ALL not resolved.

 

The above is telling you that the macro variable THUR_ALL does not exist.  Therefore the code:

SELECT     *     ,    FROM

Is invalid.

Esteemed Advisor
Posts: 6,706

Re: syntax error

If macro variable thru_all is to be used to add a variable (or several variables) to a dataset, it should contain the comma, and your code should look like

proc sql;
create table rptlib.qrtly_sum_totals as
select * &thru_all.
from rptlib.qrtly_sum_totals1;
quit;

Now you will get no ERROR if &thru_all is empty or undefined. The WARNING for an undefined macro variable will persist, though.

---------------------------------------------------------------------------------------------
Maxims of Maximally Efficient SAS Programmers
Solution
‎04-20-2017 10:00 AM
Super User
Super User
Posts: 6,383

Re: syntax error

If it is undefined then it will still generate a syntax error. It will just leave the macro reference as it was and the this: 

select * &thru_all.

Is not valid syntax.

Esteemed Advisor
Posts: 6,706

Re: syntax error


Tom wrote:

If it is undefined then it will still generate a syntax error. It will just leave the macro reference as it was and the this: 

select * &thru_all.

Is not valid syntax.


Correct. Shame on me.

---------------------------------------------------------------------------------------------
Maxims of Maximally Efficient SAS Programmers
☑ This topic is SOLVED.

Need further help from the community? Please ask a new question.

Discussion stats
  • 6 replies
  • 139 views
  • 1 like
  • 6 in conversation