Hi,
I'm using multiple proc report statements to generate number/percentage frequency tables to a PDF. Each table starts on a new page. Each table has header notes and footer notes of varying lengths. I'm using compute before/after blocks with line statements to generate this text. For few tables, the header notes are extensive, causing the table to break into multiple pages. The problem is, the header notes are repetitively printed on each page the table is broken down into, as they are printed by line statements in a 'compute before _page_' block. Is there a way to apply a conditional statement to execute the compute before block only if it is the first page of the proc report table? Thanks.
===========================
PROC REPORT DATA = X MISSING;
COLUMN A A=B DUMROW N PCTN;
COMPUTE A;
COUNT+1;
IF (MOD(COUNT,2)) THEN DO;
CALL DEFINE (_ROW_, 'STYLE', 'STYLE=[BACKGROUND=WHITE]');
END;
ENDCOMP;
TITLE J=LEFT "Table Title";
COMPUTE BEFORE _PAGE_/STYLE=[JUST=L FONTSIZE=2];
LINE "Header note 1";
LINE " ";
LINE "Header note 2";
LINE " ";
ENDCOMP;
DEFINE A /"Value" GROUP ORDER=INTERNAL FORMAT=NOPRVAL. ;
DEFINE B /"Label" GROUP ID FORMAT=B. NOPRINT ;
DEFINE DUMROW /COMPUTED "Label";
DEFINE N /"Unweighted Frequency" FORMAT=COMMA12. ;
DEFINE PCTN /"%" FORMAT=PERCENT7.1 ;
COMPUTE DUMROW /CHAR LENGTH = 50;
IF _BREAK_="_RBREAK_" THEN DO DUMROW = 'Total'; END;
ELSE DUMROW=PUT(B, B.);
IF DUMROW = 'Total' THEN CALL DEFINE (_ROW_, 'STYLE', "STYLE=[BACKGROUND=LIGHT GRAY FONTSTYLE=ITALIC FONTSIZE=2]");
ENDCOMP;
RBREAK AFTER / SUMMARIZE;
COMPUTE AFTER/STYLE=[JUST=L FONTSIZE=2];
LINE " ";
LINE "Footer note 1";
LINE "Footer note 2";
LINE " ";
LINE "Footer note 3";
ENDCOMP;
RUN;
=========================
Hi
I've noted some possible options below:
ods region width=10cm height=1cm x=1.25cm y=2.1cm;
ods text = "^{style[font_face='calibri' fontsize=1.5
just=left fontweight=bold] HEADER NOTE 1}";
TITLE J=LEFT "Table Title";
title2 "";
title3 "Header note 1";
title4 "Header note 2";
COLUMN ("header note 1 header note 2" A A=B DUMROW N PCTN);
Thanks for the response RB1Kenobi.
I tried using option 1 suggested by you but the ODS PDF text gets printed at the end of the previous table page (as there are multiple proc report tables printed and the previous proc report table isn't long enough). So I guess, the follow up question would be, how to start processing on a new page between two proc report statements which are finally printed to one PDF?
=================================
ODS PDF FILE = "file1.pdf";
proc report data = x;
column ... ... ... ...;
title 'table 1 title';
compute before _page_/ style=[just=l];
line 'table 1 header 1';
endcompute;
define ... ... ... ;
define ... ... ... ;
run;
/* HOW TO END PAGE HERE? */
ods pdf text = 'table 2 header 1';
proc report data = x;
column ... ... ... ...;
title 'table 2 title';
define ... ... ... ;
define ... ... ... ;
run;
ODS PDF CLOSE;
=====================================
And I don't think I can use option 2: multiple title statements, as in some tables, the header notes go well beyond 20-25 lines. Thank you.
Hi
Define the start of the page with:
ods pdf startpage=now;
define the end of the page with :
ods layout end;
This is a good ODS resource:
http://support.sas.com/documentation/cdl/en/odsug/65308/HTML/default/viewer.htm#titlepage.htm
Thanks again! I was able to suppress the repetition of the header notes by using ods pdf text and provide a page break by "ods pdf startpage = now". Now I get Title, header notes, half the table on page 1 and half the table on page 2.
But now, I'm left with a SAS generated message at the top of the 'second' page reading "Continuing contents of page nn, which would not fit on a single physical page" AND the title is not printed on the second page where the table spills on to. What are the options to suppress this sas generated message but print the table title instead, in this scenario?
I looked around and a method to suppress this message when ods pdf text spills over to second page is, providing a blank proc report statement. But in my case, the message needs to be suppressed when the proc report table spills over to the second page while using ods pdf text.
Thank you.
Thank you RB1Kenobi.
The tables are pretty big and they do need to be on two full pages to be readable.
Can someone help me with the issue?
I need to suppress the SAS generated text box message "Continuing contents of page nn, which would not fit on a single physical page" when a proc contents table overflows to more than one page. Being able to repeat the table title instead on the second page would be an added bonus. Thank you.
Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.
Register today!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.
Select SAS Training centers are offering in-person courses. View upcoming courses for: