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-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!

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.

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
  • 5 replies
  • 678 views
  • 0 likes
  • 4 in conversation