The SAS Output Delivery System and reporting techniques

PROC REPORT ODS PDF

Reply
Regular Contributor
Posts: 157

PROC REPORT ODS PDF

hi Message was edited by: JasonNC
SAS Super FREQ
Posts: 8,864

Re: PROC REPORT ODS PDF

Hi:
I see a few issues. You are specifying 2 usages on 1 DEFINE statement:
[pre]
DEFINE Totalfivedays / DISPLAY ORDER NOPRINT ;
DEFINE Totalsix / DISPLAY ORDER NOPRINT;
DEFINE Totalfif / DISPLAY ORDER NOPRINT;
DEFINE Totaltwen / DISPLAY ORDER NOPRINT;
DEFINE Totalmoretwen / DISPLAY ORDER NOPRINT;
DEFINE Totsumavgdays / DISPLAY ORDER NOPRINT;
DEFINE uptofivepcnt / DISPLAY ORDER NOPRINT;
DEFINE sixpcnt / DISPLAY ORDER NOPRINT;
DEFINE fifpcnt / DISPLAY ORDER NOPRINT;
DEFINE twenpcnt / DISPLAY ORDER NOPRINT;
DEFINE moretwenpcnt / DISPLAY ORDER NOPRINT;
[/pre]
and then defining them all as NOPRINT, in addition. DEFINING the variables as both DISPLAY and ORDER doesn't make sense. I believe that PROC REPORT will probably treat them as ORDER, the last usage listed on the DEFINE statement. ORDER variables (and GROUP variables and DISPLAY variables) are not summarrized or totalled as part of BREAK processing. So at the bottom of the report, think of those columns on the report row as being blank or missing.

Remember that PROC REPORT does NOT have a PDV (or Program Data Vector) like a DATA step program. So what PROC REPORT is building is 1 report row at a time. At the end of the report, there is nothing to write out from your program. Every thing is either a DISPLAY or ORDER item -- COMPUTE AFTER will then be able to write out text strings, but without any numeric items being used for analysis, there is nothing at the COMPUTE AFTER to be displayed.

Consider this program, below and note how I have added an RBREAK statement to show you that the sum for ICNT and SCNT is 395 and those numbers are accurately "echoed" in the LINE statement. But, the values for ITOTand STOT are "blank" at the break because they were DISPLAY items -- so no break number or sum was calculated for them, therefore, there is nothing to display on the LINE statement at the COMPUTE AFTER.

Compare the output from these 2 programs (below). PS...there are other methods to put multiple summaries at the bottom of the report...see my example #3 -- it does NOT use a LINE statement.

cynthia
[pre]
** pre-summarize data;
proc means data=sashelp.shoes nway n sum;
var sales inventory;
class product;
output out=work.shoeout n=scnt icnt sum=stot itot ;
run;

ods listing close;
ods pdf file='c:\temp\output\no_sum.pdf';

proc report data=work.shoeout nowd;
title '1) Show that for DISPLAY (or ORDER) variables, there is no summary and thus, nothing to display at the bottom of the report';
column product scnt stot icnt itot;
define product/ order;
define scnt / sum ;
define stot / display ;
define icnt / sum;
define itot / display ;
rbreak after / summarize;
compute after ;
line 'What is being summarized and what can be displayed?';
line ' At the bottom of the report:';
line 'stot= ' stot dollar14.;
line 'itot=' itot dollar14.;
line 'icnt=' icnt.sum comma14.;
line 'scnt=' scnt.sum comma14.;
endcomp;
run;
ods pdf close;


ods pdf file='c:\temp\output\with_sum.pdf';

proc report data=work.shoeout nowd;
title '2) Show that with SUM for stot and itot, there is a number to use at the RBREAK';
column product scnt stot icnt itot;
define product/ order;
define scnt / sum ;
define stot / sum noprint;
define icnt / sum;
define itot / sum noprint;
** rbreak after / summarize;
compute after ;
line 'What is being summarized and what can be displayed?';
line ' At the bottom of the report:';
line 'stot= ' stot.sum dollar14.;
line 'itot=' itot.sum dollar14.;
line 'icnt=' icnt.sum comma14.;
line 'scnt=' scnt.sum comma14.;
endcomp;
run;
ods pdf close;

data newshoes;
set shoeout;
extrabreak = 1;
otherbreak = 1;
run;

options missing = ' ';
ods pdf file='c:\temp\output\no_line.pdf';

proc report data=work.newshoes nowd;
title '3) Use Extra Break Variable -- which will only break 1 time';
column extrabreak otherbreak product scnt stot icnt itot;
define extrabreak / group noprint;
define otherbreak / group noprint;
define product/ order;
define scnt / sum ;
define stot / sum noprint;
define icnt / sum f=dollar15.;
define itot / sum noprint;
break after extrabreak/summarize;
break after otherbreak/summarize;
rbreak after / summarize;
compute ICNT;
if _break_ = ' ' or _break_ = '_RBREAK_'
then call define(_col_,'format','comma15.');
endcomp;
compute after extrabreak;
icnt.sum = itot.sum;
scnt.sum = .;
Product = 'ITOT.SUM Val';
endcomp;
compute after otherbreak;
icnt.sum = stot.sum;
scnt.sum = .;
Product = 'STOT.SUM Val';
endcomp;
compute after ;
icnt.sum = .;
product= 'Obs Count';
endcomp;
run;
ods pdf close;
[/pre]
Regular Contributor
Posts: 157

Re: PROC REPORT ODS PDF

Hi Cynthia,

Thanks for you help.I saw your reply.I was unable to get back to you.
Ask a Question
Discussion stats
  • 2 replies
  • 164 views
  • 0 likes
  • 2 in conversation