Error in proc sql while using group by

sas

#1

Hello,

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

;

QUIT;

RUN;

Can somebody please help me with this!!


#2

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

Kunal


#3

Hi @kunal,

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