![]() | ![]() | ![]() |
Using the SASDATEFMT= data set option as an environment variable sometimes can produce inconsistent behavior when date columns are used in WHERE clauses. Specifically, the inconsistent behavior can occur when you use SASDATEFMT=DATE. When SASDATEFMT is set to SAS DATE format, you might see the TRUNC function used in WHERE clauses for DATE columns because setting the SASDATEFMT option value to DATE format indicates that you are interested only in the date part of the datetime value in the DATE column.
However, the TRUNC function might be missing in scenarios where a performance-boosting feature overrides the regular SQL building code (this is called Implicit Pass-Through processing). For example, such an override occurs when an SQL procedure uses the keyword DISTINCT, aggregate functions [for example, COUNT(*) or SUM()], or table joins. You can see when this override occurs by using the SASTRACE= option to trace the events. When an override occurs, the following note appears in the trace log:
ACCESS ENGINE: SQL statement was passed to the DBMS for fetching data.
To illustrate this problem, assume that you have a table that contains a date column with one row, as shown below:
Now invoke SAS with the following command:
If you use the SASTRACE= option, as shown in the following example, you can see how adding the DISTINCT key in the SELECT statement changes the SQL and how one of the two WHERE clauses contains the TRUNC function:
| Product Family | Product | System | SAS Release | |
| Reported | Fixed* | |||
| SAS System | SAS/ACCESS Interface to Oracle | Microsoft® Windows® for 64-Bit Itanium-based Systems | 9.1 TS1M3 SP4 | |
| Microsoft Windows Server 2003 Datacenter 64-bit Edition | 9.1 TS1M3 SP4 | |||
| Microsoft Windows Server 2003 Enterprise 64-bit Edition | 9.1 TS1M3 SP4 | |||
| Microsoft Windows XP 64-bit Edition | 9.1 TS1M3 SP4 | |||
| Microsoft Windows 2000 Advanced Server | 9.1 TS1M3 SP4 | |||
| Microsoft Windows 2000 Datacenter Server | 9.1 TS1M3 SP4 | |||
| Microsoft Windows 2000 Server | 9.1 TS1M3 SP4 | |||
| Microsoft Windows 2000 Professional | 9.1 TS1M3 SP4 | |||
| Microsoft Windows NT Workstation | 9.1 TS1M3 SP4 | |||
| Microsoft Windows Server 2003 Datacenter Edition | 9.1 TS1M3 SP4 | |||
| Microsoft Windows Server 2003 Enterprise Edition | 9.1 TS1M3 SP4 | |||
| Microsoft Windows Server 2003 Standard Edition | 9.1 TS1M3 SP4 | |||
| Microsoft Windows XP Professional | 9.1 TS1M3 SP4 | |||
| Windows Vista | 9.1 TS1M3 SP4 | |||
| 64-bit Enabled AIX | 9.1 TS1M3 SP4 | |||
| 64-bit Enabled HP-UX | 9.1 TS1M3 SP4 | |||
| 64-bit Enabled Solaris | 9.1 TS1M3 SP4 | |||
| HP-UX IPF | 9.1 TS1M3 SP4 | |||
| Linux | 9.1 TS1M3 SP4 | |||
| Linux on Itanium | 9.1 TS1M3 SP4 | |||
| OpenVMS Alpha | 9.1 TS1M3 SP4 | |||
| Solaris for x64 | 9.1 TS1M3 SP4 | |||
| Tru64 UNIX | 9.1 TS1M3 SP4 | |||
| Type: | Problem Note |
| Priority: | high |
| Topic: | Data Management ==> Data Sources ==> External Databases ==> Oracle |
| Date Modified: | 2011-05-13 10:55:03 |
| Date Created: | 2010-02-25 17:37:50 |


