An SQLPLAN error might occur under the following circumstances:
The error might look similar to the following:
The only workaround is to split the query into two queries. In this split, the first query should create a table by running the code that was previously in the inline view. Then, in the second query, this table replaces the inline view.
See the Full Code section for sample code.
The sample code below lists an example of code that would generate the error.
data test;
t1001118=0;
applino=1;
run;
proc sql;
create table rai1001 as
select
case when le = 99 then 'LE99'
when le = 0 then 'LE0'
when le = 1 then 'LE1'
else 'err'
end as le_s,
sum(flag1) as Referrals
from ( select
case when flag1 = 1 then 1
else 2
end as le,
flag1
from (select
case when not t1001118 = 0 then 1
else 0
end as flag1 ,
count(distinct applino) as ken
from test
)
)
group by le_s ;
quit;