Differences between revisions 1 and 4 (spanning 3 versions)
Revision 1 as of 2023-01-14 04:08:32
Size: 213
Comment:
Revision 4 as of 2023-01-14 05:39:38
Size: 1323
Comment:
Deletions are marked like this. Additions are marked like this.
Line 19: Line 19:
To print all observations meeting some condition, try:

{{{
proc print data=LIBREF.TABLE noobs;
  var VARLIST;
  where EXPR;
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.



=== Where Statement ===

SAS Print


Usage

To print the first 10 observations, try:

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

To print all observations meeting some condition, try:

proc print data=LIBREF.TABLE noobs;
  var VARLIST;
  where EXPR;
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.

Where Statement


CategoryRicottone

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