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_ | change1 | pchange1 | _C4_ | change2 | pchange2 | _C5_ | change3 | pchange3 |
Less than 1 | 25126 | 25152 | -26 | -0.00103 | 25102 | 24 | 0.000955 | 23710 | 1416 | 0.05636 |
1 to 5 | 117318 | 117668 | -350 | -0.00298 | 118066 | -748 | -0.00638 | 87173 | 30145 | 0.25695 |
6 to 12 | 141621 | 141476 | 145 | 0.001024 | 137402 | 4219 | 0.029791 | 93923 | 47698 | 0.3368 |
13 to 18 | 102062 | 102078 | -16 | -0.00016 | 98468 | 3594 | 0.035214 | 65267 | 36795 | 0.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?
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
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
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.
Don't miss out on SAS Innovate - Register now for the FREE Livestream!
Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.
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.