The FEDSQL procedure might generate incorrect results


The FEDSQL procedure might generate incorrect results when the following is true:

Here is one example of a query that might generate the results. In your code, the LIBNAME statements will point to your database and to a database or a SAS library.

libname lib1 ...;
libname lib2 ...;
data lib2.TEST1;
gender='M';
output;
gender='';
output;
run;
data lib1.TEST2;
x=1;
code='M';
output;
code='F';
output;
code='o';
output;
run;
data lib1.TEST3;
x=1;
run;
proc fedsql ;
create table cartesian as
select *
from lib2."TEST1" source
inner join
(select a.*
from lib1."TEST2" a ,lib1."TEST3" b where a.x=b.x) sq
on source.gender=sq.code;

The workaround for the INNER JOIN is to use a comma with a WHERE clause instead of the INNER JOIN with the ON clause syntax. There is no workaround for the LEFT or RIGHT JOIN.