Help using Base SAS procedures

PROC Report - RBREAK & Total Row

Accepted Solution Solved
Reply
Occasional Contributor
Posts: 13
Accepted Solution

PROC Report - RBREAK & Total Row

I'm having some issues with PROC Report and I'm just banging my head against the wall here (it's probably something stupid)...

I'm passing my data through PROC Report twice - once to produce some calculations, etc., and the other to create the final report.  The issue I'm having is with step two.

Here is the data:

AgeGroup_C2__C3_change1pchange1_C4_change2pchange2_C5_change3pchange3
Less than 12512625152-26-0.0010325102240.0009552371014160.05636
1 to 5117318117668-350-0.00298118066-748-0.0063887173301450.25695
6 to 121416211414761450.00102413740242190.02979193923476980.3368
13 to 18102062102078-16-0.000169846835940.03521465267367950.36052

And here is my code:

ods pdf file="Test.pdf";

proc report nowd data=testrep;

column agegroup ("Jan-13" _c2_) ("Dec-12" _c3_ change1 pchange1) ("Jan-12" _c4_ change2 pchange2) ("Healthy Kids Baseline" ("Jun-09" _c5_ change3 pchange3));

define agegroup / display 'Age';

define _c2_ / display 'Current' format=comma12.;

define _c3_ / display 'Previous Month' format=comma12.;

define change1 / display 'Change' format=comma12.;

define pchange1 / display '% Change' format=percentn14.2;

define _c4_ / display 'Previous Year' format=comma12.;

define change2 / display 'Change' format=comma12.;

define pchange2 / display '% Change' format=percentn14.2;

define _c5_ / display 'Baseline' format=comma12.;

define change3 / display 'Change' format=comma12.;

define pchange3 / display '% Change' format=percentn14.2;

rbreak after / summarize;

run;

ods pdf close;

For some reason the Rbreak is not producing a total row like I would like.  In the PDF, it is coming out completely blank.  Anyone know why?


Accepted Solutions
Solution
‎03-19-2013 06:05 PM
SAS Super FREQ
Posts: 8,866

Re: PROC Report - RBREAK & Total Row

Posted in reply to TashaChapman

Hi, Tasha:

  Several factors have to work together for PROC REPORT to generate a summary line at the end of a report:

1) you need an RBREAK AFTER/ SUMMARIZE statement (check)

2) the variables that you want to summarize cannot be DISPLAY (NOT check in the code you show)

  I'd recommend changing some of the DISPLAY to SUM and see what happens.

cynthia

View solution in original post


All Replies
Solution
‎03-19-2013 06:05 PM
SAS Super FREQ
Posts: 8,866

Re: PROC Report - RBREAK & Total Row

Posted in reply to TashaChapman

Hi, Tasha:

  Several factors have to work together for PROC REPORT to generate a summary line at the end of a report:

1) you need an RBREAK AFTER/ SUMMARIZE statement (check)

2) the variables that you want to summarize cannot be DISPLAY (NOT check in the code you show)

  I'd recommend changing some of the DISPLAY to SUM and see what happens.

cynthia

Occasional Contributor
Posts: 13

Re: PROC Report - RBREAK & Total Row

Posted in reply to Cynthia_sas

I had a feeling it would be something like that.  Thanks for the suggestion!

Actually, what I ended up doing is adding the rbreak to the first pass-through PROC Report statement.  In the end I got an extra observation in my testrep dataset with the sums I needed.  This also allowed me to give the row a header of "Total" in the dataset by changing the "AgeGroup" value for that row.  So far it's working like a charm. Smiley Happy

🔒 This topic is solved and locked.

Need further help from the community? Please ask a new question.

Discussion stats
  • 2 replies
  • 193 views
  • 3 likes
  • 2 in conversation