Dear SAS Communities Members:
I'm using SAS version 9.3 and below is my code.
data have;
infile cards dlm=',';
length a1 $10 a2-a7 $1;
input a1 a2 a3 a4 a5 a6 a7 pp;
cards;
Category 1, a, b, c, d, e, f, 1
Category 2, a, b, c, d, e, f, 1
Category 3, a, b, c, d, e, f, 1
Category 4, a, b, c, d, e, f, 1
Category 5, a, b, c, d, e, f, 1
Category 6, a, b, c, d, e, f, 1
Category 7, a, b, c, d, e, f, 1
;
run;
options nodate nonumber papersize=A4 topmargin="0.25in" leftmargin="0.25in" bottommargin="0.25in" rightmargin="0.25in" missing=' ';
ods escapechar='^'; footnote3 j=l;footnote4 j=l;
ods document name=WORK.CONTENTS(write);
title1 j=l "^S={leftmargin=0in} Study number: xxxxx" j=r "Page ^{thispage} of ^{lastpage}";
title2 j=l j=r "^S={leftmargin=0in} Date: DDMMMYYYY";
PROC REPORT DATA=have nofs NOWD
SPLIT= '|'
LS=256
contents="Department 1";
column pp a1-a7;
define a1 /group center style=[cellwidth=30mm] 'VAR 1';
define a2 /group center style=[cellwidth=30mm] 'VAR 2';
define a3 /group center style=[cellwidth=30mm] 'VAR 3';
define a4 /group center style=[cellwidth=30mm] 'VAR 4';
define a5 /group center style=[cellwidth=30mm] 'VAR 5';
define a6 /group center style=[cellwidth=30mm] 'VAR 6';
define a7 /group center style=[cellwidth=30mm] 'VAR 7';
define pp /order noprint;
break before pp /page contents='';
TITLE3 j=center height=10pt "Title 1";
TITLE4 j=left height=10pt "Department 1";
FOOTNOTE1 j=left height=10pt "Note:";
FOOTNOTE2 j=left height=10pt "Footnote 1";
FOOTNOTE3 j=left height=10pt "Footnote 2";
FOOTNOTE4 j=left height=10pt "Footnote 3";
RUN;
TITLE3 ' ';
TITLE4 ' ';
FOOTNOTE1 ' ';
FOOTNOTE2 ' ';
FOOTNOTE3 ' ';
FOOTNOTE4 ' ';
QUIT;
%let outpath=C:\Users\john.chen\Desktop;
/*Put site and date here*/
%let yy=%substr(%sysfunc(today(),yymmdd10.),1,4);
%let mm=%substr(%sysfunc(today(),yymmdd10.),6,2);
%let dd=%substr(%sysfunc(today(),yymmdd10.),9,2);
%let time=&yy&mmⅆ
ods document close;
proc document name=WORK.CONTENTS;
ods rtf file="&outpath\test_&time..rtf" style=Styles.mystyle ;
ods printer pdf file="&outpath\test_&time..pdf" style=Styles.mystyle /* notoc*/ ; replay; run;
ods printer pdf close;
ods rtf close;
quit;
Then I will get the output as:
And I'd like to move the title and footnote to the core marked in yellow as below. And suggestion?
I'm not really sure what your are attempting for the Title and Proc Report Contents line. Do you mean to remove the blank line that appears between contents and the table?
If so that is a result of the ODS destination and style. You can use the Tagsets.rtf destination and add OPTIONS(VSPACE="NO") to the ODS statement.
Or to move the title out of the header area of the document? the ODS RTF option BODYTITLE would do that.
The location of the footnotes and titles in the header/footer part of the RTF document is also related to the destination. ODS RTF by default places titles and footnotes in the header/footer unless you use the BODYTITLE option. ODS TAGSETS.RTF places them in the body of the document by default though they will appear as table cells;
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.