@raivester wrote:
Ahh! Thank you. This is helpful. However, what if I have more than one variable. Say I have two variables that I want to get the mean for and one I want to get the total sum for? How do I specify which action I want to take for which variables?
Proc means / summary will provide many statistics for many variables.
Proc summary data= have;
class somegrouping variables;
var <list your variables to request stats here>;
output out=want sum(<list variables that you want summed>) = (list of variable names for output)
mean(<list of variabls you want the mean for>) = (list of variable names for output)
std (<list of variables you want the std for>) = ...
run;
If you don't want to type a bunch of output variable names you can use the / autoname option after requesting the variables. The statistic will be added a suffix to the variable name.
Example:
Proc summary data=sashelp.class nway;
class sex;
var age height weight;
output out=summaryexample
sum (age height)=
mean(weight)=
median(age height)=
std= /autoname;
run;
Note that as the STD statistic did not include any variables that all the variables on the VAR statement used.