Error in proc sql while using group by




While using the group by clause under proc sql as below:
proc sql;

CREATE TABLE area_sum as

SELECT area_grp,

     sum(order_new) as order_tot

FROM orders

where order_new=1

group by area_grp

order by order_tot desc

outer union corr

select 'Total' as area_grp,

     sum(order_new) as order_tot

from orders




Can somebody please help me with this!!


What is the error? Have you tried outer join instead of outer union?

Also, I would just add parenthesis around queries and indent them properly to make the grouping clear - just good code writing tip



Hi @kunal,

Thanks for the reply.I figured it out.The group by has to be at the end. :smile: