Differences between revisions 2 and 3
Revision 2 as of 2023-01-14 04:13:56
Size: 340
Comment:
Revision 3 as of 2023-01-14 04:26:27
Size: 1148
Comment:
Deletions are marked like this. Additions are marked like this.
Line 19: Line 19:


=== By Statement ===

The '''`BY`''' statement specifies one or more variables for which the `PROC PRINT` should be split.

The dataset must be presorted by the `BY` variables. If it is not, specify the `NOTSORTED` option.

If the data is sorted descending by any variable on the statement, include the `DESCENDING` keyword directly after that variable name.



=== Sum Statement ===

The '''`SUM`''' statement creates a total of the specified variable.

If there is also a '''`BY`''' statement, a total is ''also'' created for each `BY` group that contains more than one observation.
Line 23: Line 41:
  sum Sales
  sumby Region;
  by Region;
  sum Sales;
Line 30: Line 48:
=== SumBy Statement ===

The '''`SUMBY`''' statement specifies a subset of the variables specified on the `BY` statement. The totals created by the `SUM` statement are restricted to this subset.


SAS Print


Usage

To print the first 10 observations, try:

proc print data=LIBREF.TABLE(obs=10);
  var VARLIST;
run;

By Statement

The BY statement specifies one or more variables for which the PROC PRINT should be split.

The dataset must be presorted by the BY variables. If it is not, specify the NOTSORTED option.

If the data is sorted descending by any variable on the statement, include the DESCENDING keyword directly after that variable name.

Sum Statement

The SUM statement creates a total of the specified variable.

If there is also a BY statement, a total is also created for each BY group that contains more than one observation.

To create higher-level variables, try:

proc print data=LIBREF.TABLE noobs;
  by Region;
  sum Sales;
run;

SumBy Statement

The SUMBY statement specifies a subset of the variables specified on the BY statement. The totals created by the SUM statement are restricted to this subset.


CategoryRicottone

SAS/Print (last edited 2023-01-14 05:39:38 by DominicRicottone)