SUPPORT / SAMPLES & SAS NOTES
 

Support

Problem Note 65537: An SQL procedure might generate incorrect results when a variable is renamed in a query

DetailsCodeOutputHotfixAboutRate It

In Base SAS® software, incorrect results might occur when you run an SQL procedure query and the following conditions exist:

  • You create view1, which references a database management system (DBMS) table and that includes a GROUP BY clause that contains two variables that are being renamed via a SELECT clause.
  • You create view2 based on view1 in which you create a new variable based off one of the renamed variables from view1.
  • You create view3 based on view2 in which two of the three variables from view2 are renamed and a third variable is summed. The GROUP BY clause includes the original names as they existed in view2.
  • You are running one of the following versions:
    • SAS® 9.4M4 (TS1M4) with either of these Base SAS hot fixes: A3Z058 or A3Z067
    • SAS® 9.4M5 (TS1M5) with any of the following Base SAS hot fixes: B6Q027,B6Q044, B6Q045, B6Q056, B6Q071, B6Q073, or B6Q076 B6Q087
    • SAS® 9.4M6 (TS1M6)

See the Full Code tab for an example of code that would encounter this problem.

In this scenario, instead of the data being simply summarized, the summarized results are "re-merged" with the original data, which results in duplicate rows. You can see an example of the incorrect results that are generated on the Output tab.

The only workaround is to add DISTINCT to the SELECT clause of view3 or to not rename the variables in view2.

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 SASz/OS9.4 TS1M6
z/OS 64-bit9.4 TS1M6
Microsoft® Windows® for x649.4 TS1M6
Microsoft Windows 8 Enterprise 32-bit9.4 TS1M6
Microsoft Windows 8 Enterprise x649.4 TS1M6
Microsoft Windows 8 Pro 32-bit9.4 TS1M6
Microsoft Windows 8 Pro x649.4 TS1M6
Microsoft Windows 8.1 Enterprise 32-bit9.4 TS1M6
Microsoft Windows 8.1 Enterprise x649.4 TS1M6
Microsoft Windows 8.1 Pro 32-bit9.4 TS1M6
Microsoft Windows 8.1 Pro x649.4 TS1M6
Microsoft Windows 109.4 TS1M6
Microsoft Windows Server 2012 Datacenter9.4 TS1M6
Microsoft Windows Server 2012 R2 Datacenter9.4 TS1M6
Microsoft Windows Server 2012 R2 Std9.4 TS1M6
Microsoft Windows Server 2012 Std9.4 TS1M6
Microsoft Windows Server 20169.4 TS1M6
Microsoft Windows Server 20199.4 TS1M6
Windows 7 Enterprise 32 bit9.4 TS1M6
Windows 7 Enterprise x649.4 TS1M6
Windows 7 Home Premium 32 bit9.4 TS1M6
Windows 7 Home Premium x649.4 TS1M6
Windows 7 Professional 32 bit9.4 TS1M6
Windows 7 Professional x649.4 TS1M6
Windows 7 Ultimate 32 bit9.4 TS1M6
Windows 7 Ultimate x649.4 TS1M6
64-bit Enabled AIX9.4 TS1M6
64-bit Enabled Solaris9.4 TS1M6
HP-UX IPF9.4 TS1M6
Linux for x649.4 TS1M6
Solaris for x649.4 TS1M6
* 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.