SUPPORT / SAMPLES & SAS NOTES
 

Support

Problem Note 50584: Syntax error is generated within PROC SQL when a query is inside a macro

DetailsHotfixAboutRate It

Syntax errors occur when a PROC SQL query is embedded within a user-created macro function and the following conditions exist:

  • A comment flows for more than two lines and is at least as long as the comment in the code. Also, the comment does not extend to a third line.
  • No blank line exists between the comment and the beginning of the SQL code.
  • A macro variable, terminated with a period (.), is referenced on the WHERE clause and is compared to a column with the < symbol. (The problem occurs with the > symbol, too, but not with: =, <=, >= or <> symbols.)
  • The terminating semicolon (;) must be on a separate line after the WHERE clause.

Here are four possible changes that prevent the error:

  • Removing the period (.) after the macro variable referenced on the WHERE clause
  • Moving the semicolon (;) that terminates the PROC SQL step to the same line as the WHERE clause
  • Removing the blank line between the %MACRO declaration and the comment prior to the PROC SQL invocation
  • Moving the comment out of the macro and putting the comment prior to the %MACRO declaration

Click the Hot Fix tab in this note to access the hot fix for this issue.



Operating System and Release Information

Product FamilyProductSystemSAS Release
ReportedFixed*
SAS SystemN/AZ649.3 TS1M29.4 TS1M1
z/OS9.3 TS1M29.4 TS1M1
* For software releases that are not yet generally available, the Fixed Release is the software release in which the problem is planned to be fixed.