SUPPORT / SAMPLES & SAS NOTES
 

Support

Problem Note 15400: Incorrect number of observations returned using compound WHERE statement with IN operator

DetailsHotfixAboutRate It

Using a compound WHERE clause and the IN operator referencing the same variable returns an incorrect number of observations. For example,

data one; do x = "a", "b", "m"; output; end; run; data two; set one; where x = "a" or x = "b" or x in ("c" "d" "e" "f" "g" "h" "i" "j" "k" "l" "m" "n" "o" "p" "q" "r"); run;

returns 2 observations instead of 3 observations.

The circumvention is to use a WHERE clause with the IN operator that enumerates all the values, instead of a compound WHERE. If you change the above WHERE clause to the following:

where x in ("a" "b" "c" "d" "e" "f" "g" "h" "i" "j" "k" "l" "m" "n" "o" "p" "q" "r");

the correct number of observations are returned.

Another circumvention is to use an IF statement instead of a WHERE.

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