SUPPORT / SAMPLES & SAS NOTES
 

Support

Problem Note 16547: Correlated subqueries using column aliases may not be passed to your dbms when using SAS/ACCESS LIBNAME statement

DetailsHotfixAboutRate It

PROC SQL queries containing correlated subqueries may not be passed to the dbms with implicit passthru. An example of such a query is:

proc sql; select prodname as products, count(distinct custname) as cound from dbmslib.invoice as i1 group by prodname having (select sum(invqty) from invoice where prodname=i1.prodname) > 30 order by 1,2; quit;

You SAS code may also generate dbms-specific error messages due to column aliases incorrectly appearing in conditional expressions. For example, with the following query:

proc sql; select a.name as nalias, a.sex from kw.t1 a, kw.t1 b where a.sex='F' and a.name in (select name from kw.t1 c where a.name=c.name) and a.sex='F';

PROC SQL passes the following query to the dbms:

select a."NAME" as nalias, a."SEX" from T1 a, T1 b where a."NAME" in (select c."NAME" from T1 c where nalias = c."NAME" ) and (a."SEX" = 'F')

You will see the following error when this query is run against an Oracle database. Various other databases will generate similar errors.

ERROR: ORACLE prepare error: ORA-00904: "NALIAS": invalid identifier. SQL statement: select a."NAME" as nalias, a."SEX" from T1 a, T1 b where a"NAME" in (select c."NAME" from T1 c where nalias = c."NAME") and (a."SEX" = 'F')

The alias 'nalias' appearing in the subquery is incorrect. There currently is no circumvention for this problem.

Select 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 XP Professional9.1 TS1M3
Microsoft® Windows® for 64-Bit Itanium-based Systems9.1 TS1M3
Microsoft Windows XP 64-bit Edition9.1 TS1M3
Microsoft Windows NT Workstation9.1 TS1M3
Microsoft Windows Server 2003 Standard Edition9.1 TS1M3
Microsoft Windows Server 2003 Datacenter Edition9.1 TS1M3
Microsoft Windows Server 2003 Enterprise Edition9.1 TS1M3
Microsoft Windows 2000 Datacenter Server9.1 TS1M3
Microsoft Windows 2000 Professional9.1 TS1M3
Microsoft Windows 2000 Server9.1 TS1M3
z/OS9.1 TS1M3
64-bit Enabled Solaris9.1 TS1M3
Microsoft Windows 2000 Advanced Server9.1 TS1M3
Linux9.1 TS1M3
Linux on Itanium9.1 TS1M3
HP-UX IPF9.1 TS1M3
64-bit Enabled HP-UX9.1 TS1M3
OpenVMS Alpha9.1 TS1M3
64-bit Enabled AIX9.1 TS1M3
Tru64 UNIX9.1 TS1M3
* 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.