SUPPORT / SAMPLES & SAS NOTES
 

Support

Problem Note 63348: Incorrect results are returned when you use a WHERE clause in an SQL procedure to subset blanks

DetailsHotfixAboutRate It

Incorrect results are returned when you subset blanks on a database management system (DBMS) table with a WHERE clause using the SQL procedure.

You encounter this issue when you run code that is similar to the following:

%let connOptions=DATABASE=test SERVER="verthost" PORT=5433;
%let userpw=user=user-ID password=pw123;
%let sysconnOptions=&userpw. &connOptions.;
%let tabName=zz;

%let engine=sasiovrt;

libname x &engine. &sysconnOptions. ;


%macro execQuery(query);
proc sql;
connect to &engine. (&sysconnOptions. );
execute(&query)by &engine.;
disconnect from &engine.;
quit;
%mend;

%execQuery(DROP TABLE &tabName.);
%execQuery(CREATE TABLE &tabName. ( "name" varchar(4) ));
%execQuery(insert into &tabName.( name) values ( 'test'));
%execQuery(insert into &tabName.( name) values ( ''));
%execQuery(insert into &tabName.( name) values ( ' '));

proc sql; select       *  from x.zz where name = ''; quit;
proc sql; select count(*) from x.zz where name = ''; quit;

There are two workarounds for this issue:

  • Use the SQL pass-through facility to ensure that the DBMS handles processing.
  • Add the is not null expression to WHERE clauses and ON clauses to ensure that you obtain the same result regardless of whether SAS or the DBMS does the processing.

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 SystemSAS/ACCESS Interface to VerticaSolaris for x649.4_M49.4_M59.4 TS1M49.4 TS1M5
Linux for x649.4_M49.4_M59.4 TS1M49.4 TS1M5
HP-UX IPF9.4_M49.4_M59.4 TS1M49.4 TS1M5
64-bit Enabled Solaris9.4_M49.4_M59.4 TS1M49.4 TS1M5
64-bit Enabled AIX9.4_M49.4_M59.4 TS1M49.4 TS1M5
Microsoft® Windows® for x649.4_M49.4_M59.4 TS1M49.4 TS1M5
* 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.