abhishekdagarit
9/21/2017 - 3:20 PM

Sum of variables

Sum of variables

Sum of single variable

Simply write sum followed by the variable name.

proc print data=test;
sum salary;
run;

Sum of two variables

Simply mention the sum followed by the variable names.

proc print data=test;
sum salary rating;
run;

Sequence of statments in Sum doesn't matter

proc print data=work.test;
by post;
sum salary;
run;
proc print data=work.test;
sum salary;
by post;
run;
proc print data=work.test;
by descending post;
sum salary;
run;

Sorting in descending order

proc sort data=work.test;
by descending post;
run;
proc print data=work.test;
by descending post;
sum salary;
run;