SUPPORT / SAMPLES & SAS NOTES
 

Support

Problem Note 62724: A WHERE clause that contains an OR condition returns incorrect results when the first two arguments of the OR condition are the same

DetailsHotfixAboutRate It

If you use a WHERE clause that contains an OR condition and the first two arguments in the OR condition are identical, an incorrect number of observations might be returned.

The following code example illustrates the issue. After the code executes, zero observations occur, but the expectation is that one observation should be returned:

data test;
   var1="abc001"; var2="LOOK FOR ME(HERE)"; output;
   var1="def001"; var2="I AM NOT HERE    "; output;
run;
data ex1;
   set test;
   where (findw("LOOK FOR ME",strip(upcase(var1)))) or
         (findw("LOOK FOR ME",strip(upcase(scan(var2,1,'('))),' '));
run;

No notes, warnings, or errors are issued in the SAS® log to indicate that an incorrect number of observations has been returned.

A workaround is to substitute an IF statement in place of the WHERE clause. Using an IF statement in the code example above returns the correct expected number of observations.

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



Operating System and Release Information

Product FamilyProductSystemProduct ReleaseSAS Release
ReportedFixed*ReportedFixed*
SAS SystemBase SASSolaris for x649.49.4_M69.4 TS1M09.4 TS1M6
Linux for x649.49.4_M69.4 TS1M09.4 TS1M6
HP-UX IPF9.49.4_M69.4 TS1M09.4 TS1M6
64-bit Enabled Solaris9.49.4_M69.4 TS1M09.4 TS1M6
64-bit Enabled AIX9.49.4_M69.4 TS1M09.4 TS1M6
Windows 7 Professional x649.49.4_M69.4 TS1M09.4 TS1M6
Microsoft Windows Server 2012 R2 Datacenter9.49.4_M69.4 TS1M09.4 TS1M6
Microsoft Windows Server 2012 Datacenter9.49.4_M69.4 TS1M09.4 TS1M6
Microsoft Windows Server 2008 for x649.49.4 TS1M0
Microsoft Windows Server 2008 R29.49.4 TS1M0
Microsoft Windows 8 Pro x649.49.4_M69.4 TS1M09.4 TS1M6
Microsoft Windows 8 Enterprise x649.49.4_M69.4 TS1M09.4 TS1M6
Microsoft® Windows® for x649.49.4_M69.4 TS1M09.4 TS1M6
z/OS 64-bit9.49.4_M69.4 TS1M09.4 TS1M6
Windows 7 Enterprise x649.49.4_M69.4 TS1M09.4 TS1M6
Microsoft Windows Server 2012 Std9.49.4_M69.4 TS1M09.4 TS1M6
Microsoft Windows Server 2012 R2 Std9.49.4_M69.4 TS1M09.4 TS1M6
Microsoft Windows 109.49.4_M69.4 TS1M09.4 TS1M6
Microsoft Windows 8.1 Pro x649.49.4_M69.4 TS1M09.4 TS1M6
Microsoft Windows 8.1 Pro 32-bit9.49.4_M69.4 TS1M09.4 TS1M6
Microsoft Windows 8.1 Enterprise x649.49.4_M69.4 TS1M09.4 TS1M6
Microsoft Windows 8.1 Enterprise 32-bit9.49.4_M69.4 TS1M09.4 TS1M6
z/OS9.49.4_M69.4 TS1M09.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.