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.
Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!
Check out this tutorial series to learn how to build your own steps in SAS Studio.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.