An error might occur when you run an SQL procedure query when the following conditions exist:
The error might look similar to the following:
Submitting a query similar to the following might result in the above error:
proc sql;
create view v2 as
select
x, y, max(z) as mz
from t2
group by x, y;
quit;
proc sql;
create table results as
select t1.x, sum(t1.y) as sy, v2.mz
from t1 left join v2
on t1.x=v2.x
group by 3;
quit;
The only workaround is to use the variable name rather than its position in the GROUP BY clause.