Slow performance might occur when using set operators with PROC SQL


When you use the SQL procedure and the following conditions apply to your query, an invalid query might be passed to the database:

This sample program provides an example of code that generates the error:

proc sql;
create table t1 as
select name as who, 'class1' as newvar
from mydb.class1
union
select name as who, 'class2' as newvar
from mydb.class2
where age=14;
quit;

The invalid query results in a database error. So SAS retrieves the data and does the processing instead. This issue likely results in slower performance.

Here are the workarounds: