Generating Column Totals

Basic Column Totals

With the help of SUM statement we can generate total value of columns. SUM statement is used in PROC PRINT step.


Subtotals

To generate Subtotals, we shall add both SUM statement and BY statement in PROC PRINT step.

Subtotals with ID

We can use ID statement if we do not wish to display Obs.

Subtotals on Separate Pages

PAGEBY statement is used to print BY groups of the variable(variable used for sorting) separately. The groups appear on separate pages. The horizontal lines show the demarcation of pages.

SAS_subtotals_separate pages

SAS_subtotals_separate pages

Note: The displayed pictures for result – Column totals and Subtotals on Separate Pages are cropped and do not show the complete result for aesthetic reasons.

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s