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!
It's pretty simple in PROC REPORT.
awesome! Would I use PROC Report after putting the table together, or would this only need one PROC statement altogether?
@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.
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.
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.