SUPPORT / SAMPLES & SAS NOTES
 

Support

Problem Note 69802: Trying to use a WHERE clause with an SQL view might result in the error "ERROR: sqlplan internal error"

DetailsHotfixAboutRate It

An SQL procedure query might result in a SQLPLAN error when you attempt to subset a view based on a variable that has previously been defined with a column modifier. 

The error might look similar to the following:

ERROR; sqlplan internal error: Cannot find symbol xxxx, var-15, tag=0003. This message can be caused by attempting to  make correlated references between two different items on a single FROM clause.

This issue has been identified in the following three scenarios. However, there are likely more scenarios where this issue might occur.

Scenario 1: 

  1. You create an SQL view of one table.
  2. You create a second SQL view where the following is true:
    • The first view and a table are joined using an INNER JOIN with an ON clause or a NATURAL INNER JOIN.
    • At least one of the variables used in the join is defined with a modifier including LENGTH=, LABEL=, INFORMAT=, and FORMAT=.
  3. You create a third SQL view where the following is true:
    • The second view and a table are joined using an INNER JOIN with an ON clause or a NATURAL INNER JOIN. The join type can be the same or different from what was used in the second view.
    • The same variables are defined with a column modifier. The modifier can be the same or a different modifier from what was used in the second view.
  4. You create a forth SQL view where the following is true:
    • The query references the third view.
    • The same variables are defined with a column modifier. The modifier can be the same or a different modifier from what was used in the second and third view.
  5. Your SQL query subsets the forth view with a WHERE clause using a variable that was defined with a column modifier.

Scenario 2:

  1. You create an SQL view of one table.
  2. You create a second SQL view where the following is true:
    • The first view and a table are joined using an INNER JOIN with an ON clause, a NATURAL INNER JOIN, or by coding the INNER JOIN using a comma between the tables rather than using INNER JOIN syntax.
    • At least one of the variables used in the join is defined with a modifier including LENGTH=, LABEL=, INFORMAT=, and FORMAT=.
  3. You create a third SQL view where the following is true:
    • The second view and a table are joined using an INNER, LEFT, CROSS, NATURAL INNER, or NATURAL LEFT JOIN with an ON clause or a NATURAL INNER JOIN. The join type can be the same or different from what was used in the second view.
    • The same variables are defined with a column modifier. The modifier can be the same or a different modifier from what was used in the second view.
  4. Your SQL query subsets the third view with a WHERE clause using a variable that was defined with a column modifier

Scenario 3:

  1. You create an SQL view that performs a UNION on two tables.
  2. You create a second SQL view where the following is true:
    • The first view and the original table referenced in the first view are joined using an INNER JOIN with an ON clause, a NATURAL INNER JOIN, or by coding the INNER JOIN using a comma between the tables rather than using INNER JOIN syntax.
    • At least one of the variables used in the join is defined with a modifier including LENGTH=, LABEL=, INFORMAT=, and FORMAT=.
  3. You create a third SQL view where the following is true:
    • The query references the second view.
    • The same join variables are defined with a column modifier. The modifier can be the same or different modifier from what was used in the second view.
  4. Your SQL query subsets the third view with a WHERE clause using a variable that was defined with a column modifier

You can use one of the following workarounds for this issue:

  • Create intermediate tables rather than views.
  • Remove the column modifiers in at least one of the intermediate views for the variable that you are subsetting on. 

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 SystemBase SASMicrosoft Windows Server 20169.4 TS1M8
Microsoft Windows Server 2012 Std9.4 TS1M8
Microsoft Windows Server 2008 for x649.4 TS1M8
Microsoft Windows Server 2008 R29.4 TS1M8
Microsoft Windows Server 20089.4 TS1M8
Microsoft Windows Server 2003 for x64
Microsoft Windows Server 2003 Standard Edition
Microsoft Windows Server 2003 Enterprise Edition
Microsoft Windows Server 2003 Datacenter Edition
Microsoft Windows NT Workstation
Microsoft Windows 2000 Professional
Microsoft Windows 2000 Advanced Server
Microsoft Windows 95/98
Microsoft Windows 119.4 TS1M8
Microsoft Windows 109.4 TS1M8
Microsoft Windows 8.1 Pro 32-bit9.4 TS1M8
Microsoft Windows 8.1 Enterprise x649.4 TS1M8
Microsoft Windows 8.1 Enterprise 32-bit9.4 TS1M8
Microsoft Windows 8 Pro x649.4 TS1M8
Microsoft Windows 8 Pro 32-bit9.4 TS1M8
Microsoft Windows 8 Enterprise x649.4 TS1M8
Microsoft Windows 8 Enterprise 32-bit9.4 TS1M8
Macintosh9.4 TS1M8
z/OS 64-bit9.4 TS1M8
Microsoft Windows Server 2012 R2 Std9.4 TS1M8
Microsoft Windows Server 2012 R2 Datacenter9.4 TS1M8
Microsoft Windows Server 2012 Datacenter9.4 TS1M8
Microsoft Windows 2000 Server
Microsoft Windows 2000 Datacenter Server
Microsoft Windows 8.1 Pro x649.4 TS1M8
OS/2
Microsoft® Windows® for x649.4 TS1M8
Microsoft Windows XP 64-bit Edition
Microsoft Windows Server 2003 Enterprise 64-bit Edition
Microsoft Windows Server 2003 Datacenter 64-bit Edition
Microsoft® Windows® for 64-Bit Itanium-based Systems
z/OS9.4 TS1M8
Microsoft Windows Server 20199.4 TS1M8
Microsoft Windows Server 20229.4 TS1M8
Microsoft Windows XP Professional
Windows 7 Enterprise 32 bit9.4 TS1M8
Windows 7 Enterprise x649.4 TS1M8
Windows 7 Home Premium 32 bit9.4 TS1M8
Windows 7 Home Premium x649.4 TS1M8
Windows 7 Professional 32 bit9.4 TS1M8
Windows 7 Professional x649.4 TS1M8
Windows 7 Ultimate 32 bit9.4 TS1M8
Windows 7 Ultimate x649.4 TS1M8
Windows Millennium Edition (Me)
Windows Vista
Windows Vista for x64
64-bit Enabled AIX9.4 TS1M8
64-bit Enabled HP-UX9.4 TS1M8
64-bit Enabled Solaris9.4 TS1M8
ABI+ for Intel Architecture9.4 TS1M8
AIX9.4 TS1M8
HP-UX9.4 TS1M8
HP-UX IPF9.4 TS1M8
IRIX9.4 TS1M8
Linux9.4 TS1M8
Linux for x649.4 TS1M8
Linux on Itanium9.4 TS1M8
OpenVMS Alpha9.4 TS1M8
OpenVMS on HP Integrity9.4 TS1M8
Solaris9.4 TS1M8
Solaris for x649.4 TS1M8
Tru64 UNIX9.4 TS1M8
* 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.