BookmarkSubscribeRSS Feed
JibJam221
Obsidian | Level 7

Hello, I am looking to add a "grand totals" row at the end of my report, that provides a sum of each column in the dataset. Is there any way to do this?

First, I created a dataset to calculate the variables (PR) and (AB) to populate the columns. 

proc sql;
create table tbl_AP as
 select
  Grlvl as GROUP,
  count(PR) as Total,
  count (AB) as Ind
from db.emp
 where GROUP= 3
 group by Grlvl;
quit;

Then, I make this into a report, and add an extra column to calculate the percentage of a specific population using the two variables from tbl_AP.

 

proc sql;
Title "Distribution of People in";
select GROUP label="G-L",
 Total,
 Ind,
 Ind/Total as Ins_Percentage format=Percent8.1 label= " %"
from tbl_AP;
quit;

 

Thanks!

3 REPLIES 3
PaigeMiller
Diamond | Level 26

It's pretty simple in PROC REPORT.

--
Paige Miller
JibJam221
Obsidian | Level 7

awesome! Would I use PROC Report after putting the table together, or would this only need one PROC statement altogether?

PaigeMiller
Diamond | Level 26

@JibJam221 wrote:

awesome! Would I use PROC Report after putting the table together, or would this only need one PROC statement altogether?


Either. It's up to you.

 

There are examples in the PROC REPORT documentation of using the RBREAK command to add summary statistics at the bottom of the report.

--
Paige Miller

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

SAS Enterprise Guide vs. SAS Studio

What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 3 replies
  • 782 views
  • 1 like
  • 2 in conversation