Help using Base SAS procedures

Proc Report - creating output of summary lines

Reply
N/A
Posts: 0

Proc Report - creating output of summary lines

Hi everyone,

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

Thanks!
Super Contributor
Super Contributor
Posts: 3,174

Re: Proc Report - creating output of summary lines

Posted in reply to deleted_user
Suggested Google advanced search argument to consider based on your post's topic area:

proc report group summary site:sas.com
Regular Contributor
Regular Contributor
Posts: 156

Re: Proc Report - creating output of summary lines

Posted in reply to deleted_user
Hi Shell,

do a proc summary first which returns one single row.

Best regards
Eva
N/A
Posts: 0

Re: Proc Report - creating output of summary lines

Thanks Eva,
I'll try that.

Shelley
SAS Super FREQ
Posts: 8,864

Re: Proc Report - creating output of summary lines

Posted in reply to deleted_user
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
N/A
Posts: 0

Re: Proc Report - creating output of summary lines

Posted in reply to Cynthia_sas
Thank you for including details, Cynthia!
Ask a Question
Discussion stats
  • 5 replies
  • 102 views
  • 0 likes
  • 4 in conversation