BookmarkSubscribeRSS Feed
deleted_user
Not applicable
Hi everyone,

I need to create an output report of only the summary lines created in Proc Report. What code will accomplish this?

Thanks!
5 REPLIES 5
sbb
Lapis Lazuli | Level 10 sbb
Lapis Lazuli | Level 10
Suggested Google advanced search argument to consider based on your post's topic area:

proc report group summary site:sas.com
Eva
Quartz | Level 8 Eva
Quartz | Level 8
Hi Shell,

do a proc summary first which returns one single row.

Best regards
Eva
deleted_user
Not applicable
Thanks Eva,
I'll try that.

Shelley
Cynthia_sas
SAS Super FREQ
Hi:
PROC REPORT has the ability to produce either GROUP (summary) or ORDER (detail) reports.

For example, this code:
[pre]
proc report data=sashelp.shoes nowd;
column region subsidiary sales;
define region / order;
define subsidiary / order;
define sales/ sum;
break after region / summarize;
run;
[/pre]

In the above report, I would see a detail line for every observation, ordered by region/subsidiary, with a summary line underneath every region. For example, if the dataset has 500 observations, I would have at least 500 report rows. If I have 10 regions in the data, then the detail report would also have 10 summary lines.

If I ONLY want to see the REGION information -- or 10 summary lines for each REGION, then the above code needs to drop subsidiary and change the usage for REGION to GROUP:
[pre]
proc report data=sashelp.shoes nowd;
column region sales;
define region / group;
define sales/ sum;
rbreak after / summarize;
run;
[/pre]

Now, I will only see the summarized sales for each region, without any detail lines coming from the subsidiary information.

Or, you could use other procedures, like PROC MEANS or PROC SQL to "pre-summarize" the data and then pass the summary info to PROC REPORT. This does, however, require 2 passes through the data -- which isn't too horrible for small to medium datasets, but really unnecessary, when PROC REPORT will do it in one step...summarizing and reporting.

cynthia
deleted_user
Not applicable
Thank you for including details, Cynthia!

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 5 replies
  • 928 views
  • 0 likes
  • 4 in conversation