> Why does your sum statement have two 'sum' functions?
> I can't test it at the moment, but would suggest
> trying it as sum(normal,etc., etc.).
>
> Art
> -----------
> > Hi
> >
> > I am trying to sum using proc sql but I get the
> > following on the log window
> >
> > proc sql;
> > 519 create table limbs3 as
> > 520 select
> > 521 id,
> > 522 sum(sum(normal, alo2, call3, red4, wound5,
> > callswe6,
> > 523 swound7, sswe8, swound_sswe9)) as
> score
> > 524 FROM limbs_sum;
> > ERROR: Function SUM requires a numeric expression
> as
> > argument 1.
> > ERROR: Function SUM requires a numeric expression
> as
> > argument 2.
> > ERROR: Function SUM requires a numeric expression
> as
> > argument 3.
> > ERROR: Function SUM requires a numeric expression
> as
> > argument 4.
> > ERROR: Function SUM requires a numeric expression
> as
> > argument 5.
> > ERROR: Function SUM requires a numeric expression
> as
> > argument 6.
> > ERROR: Function SUM requires a numeric expression
> as
> > argument 7.
> > ERROR: Function SUM requires a numeric expression
> as
> > argument 8.
> > ERROR: Function SUM requires a numeric expression
> as
> > argument 9.
> > ERROR: The SUM summary function requires a numeric
> > argument.
> > 525 group by id;
> > 526 quit;
> >
> >
> > what am I doing wrong?
> >
> > Thanks for your help
I think you put a semi-colon after your FROM CLAUSE and that needs to be removed.
The syntax works for me by using the below code
proc sql;
create table table1 as
select region
,sum(sum(sales,returns)) as gross_sales
from sashelp.shoes
group by region;
quit;
yet if I use a char data type i get your message. see below
16 proc sql;
17 create table table3 as
18 select region
19 ,sum(sum(product,returns)) as gross_sales
20 from sashelp.shoes
21 group by region;
ERROR: Function SUM requires a numeric expression as argument 1.
ERROR: The SUM summary function requires a numeric argument.
Also I would check the data types of your table
proc sql;
describe table limbs_sum;
quit;
to double check
Add to Art297. the sum by itself just adds the columns together, the double sum then aggregates the summed columns .
D