In the SQL procedure, a sub-query in the SELECT statement's ON clause is not processed properly. This happens when you use the OLEDB LIBNAME engine and when PROC SQL contains a left join, as shown in this example:
libname se_pil oledb . . .more options. . . schema=dbo;
data account_list;
account_key=163304;
run;
proc sql;
select a.account_key, b.snapshot_date_key, b.value,
b.Months_on_books
from account_list as a
left join se_pil.test_account as b
on a.account_key=b.account_key and
b.Months_on_books=3
and b.snapshot_date_key
in(select date_key from se_pil.date_dimension
where cycle_day_flag ne 0);
quit;
As a workaround, specify DIRECT_SQL=NO in the LIBNAME statement.