Syntax, SUM statement:
SUM variable(s);
|
proc print data=cert.insure;
var name policy balancedue;
where pctinsured < 100;
sum balancedue;
run;
Syntax, BY statement
in the PRINT procedure:
BY <DESCENDING> BY-variable-1
<...<DESCENDING> <BY-variable-n>>
<NOTSORTED>;
|
proc sort data=cert.admit out=work.activity; /*#1*/ by actlevel; run; proc print data=work.activity; var age height weight fee; where age>30; sum fee; /*#2*/ by actlevel; /*#3*/ run;
1 | The PROC SORT step sorts the permanent SAS data set Cert.Admit by the values of the variable ActLevel. The OUT= option creates the temporary SAS data set Activity. |
2 | The SUM statement produces column totals for the numeric variable Fee. |
3 | The BY statement specifies ActLevel as the variable that PROC PRINT uses to form BY groups. |
proc sort data=cert.admit out=work.activity; /*#1*/ by actlevel; run; proc print data=work.activity; var age height weight fee; where age>30; sum fee; /*#2*/ by actlevel; /*#3*/ id actlevel; /*#4*/ run;
1 | The PROC SORT step sorts the permanent SAS data set Cert.Admit by the values of the variable ActLevel. The OUT= option creates the temporary SAS data set Activity. |
2 | The SUM statement produces column totals for the numeric variable Fee. |
3 | The BY statement specifies ActLevel as the variable that PROC PRINT uses to form BY groups. |
4 | The ID statement specifies ActLevel as the variable that replaces the Obs column and listed only once for each BY group and once for each sum. The BY lines are suppressed, and the values of the ID statement variable ActLevel identify each BY group. |
Syntax, PAGEBY statement:
PAGEBY BY-variable:
|
proc sort data=cert.admit out=work.activity;
by actlevel;
run;
proc print data=work.activity;
var age height weight fee;
where age>30;
sum fee;
by actlevel;
id actlevel;
pageby actlevel;
run;