Skip to content

Instantly share code, notes, and snippets.

@abhishekdagarit
Last active September 21, 2017 15:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save abhishekdagarit/4f15f61c930f7ff8ef2c15a145b2f3c9 to your computer and use it in GitHub Desktop.
Save abhishekdagarit/4f15f61c930f7ff8ef2c15a145b2f3c9 to your computer and use it in GitHub Desktop.
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;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment