Good day
I am trying to remove the highlighted space between title and output. Please advice, I also want to remove italic font on the column header
Please see attached my code and screenshot of the report.
HI:
Here's an example of what happens with TAGSETS.RTF and a template change to PARSKIP:
To invoke the destination, instead of ODS RTF, you use ODS TAGSETS.RTF as shown below:
Then the PROC REPORT code was mostly the same with a few changes -- deleted the cellheight for the header:
More define statements and COMPUTE blocks (deleted the compute after CAT):
The close for the destination:
You don't need the BODYTITLE option because the title always goes into the body of the document with TAGSETS.RTF.
Hope this helps you get what you want.
Cynthia
Many people don't want to open docx documents because of security issues or organization policies.
Provide the code you are currently using to create the output. Copy from your editor and paste into a code box opened on the forum with either the </> or "running man" icon. You should include your ODS destination statement, the current active ODS style and all options.
If you are using a custom ODS style you might end up having to provide that as well.
Space between objects is usually defined with the PARSKIP attribute in either an ODS style or destination option (in the case of TAGSETS.RTF IIRC)
************REPORT************/
options orientation=landscape nodate nonumber topmargin=.5in bottommargin=.1in rightmargin=.5in leftmargin=.55in
;
ods escapechar='^';
ods listing close;
ods RTF file="C:\Users\Dinkepile\Desktop\IBISS\Dataset\22 Jul 2020 Complete Data to Justin\Tables\Output\Table 14.1.1.rtf" bodytitle
style=JOURNAL;
TITLE1 J=L height=12pt FONT='Courier New' lspace=2pt 'Table 14.1.1: Disposition of Subjects';
TITLE2 J=L height=12pt FONT='Courier New' lspace=2pt 'All Subjects';
proc report data=final1_ nowd split='~' missing style ( report )=[frame=hsides outputwidth = 9in background = white
font_face='Courier New' font_size=4]
style(column)={just=CENTER font_face='Courier New' background=white foreground=black
font_size=4 cellwidth=.6in}
style(header)={just=center font_face='Courier New' cellheight=.39in font_size=4
foreground=black cellwidth=.6in
background=white } ;
column _page sot sort cnt CAT ( UC CD TOTAL);
define _page / order order=internal noprint;
define sot / ORDER order=internal noprint ;
define sort / order order=internal noprint;
define CNT / order order=internal noprint;
define CAT / display " " style(header)={just=left cellwidth=3in}
style(column)={just=left cellwidth=3in
font_face='Courier New' font_size=3};
define UC / display 'UC~N' style(header)={just=CENTER cellwidth=0.5in}
style(column)={just=CENTER cellwidth=0.5in font_weight=medium
font_face='Courier New' font_size=3};
define CD / display 'CD~N' style(header)={just=CENTER cellwidth=0.5in}
style(column)={just=CENTER cellwidth=0.5in
font_face='Courier New' font_size=3};
define TOTAL / display 'All Subjects~N' style(header)={just=CENTER cellwidth=0.9in}
style(column)={just=CENTER cellwidth=0.9in
font_face='Courier New' font_size=3 protectspecialchars = off};
compute CAT;
if cnt>=7 then do;
call define(_col_,'style','style={leftmargin=.15in}');
end;
endcomp;
compute before _page;
line " ";
endcomp;
compute AFTER sot;
line " ";
endcomp;
compute after CAT;
line " ";
endcomp;
run;
ods RTF close;
ods listing;
title;
Hi:
I did not run your code since you did not provide data, but running a test with PROC REPORT and ODS RTF and the JOURNAL style, as shown below:
I don't see any extra space under the column header, such as you describe. I wonder if the extra line is coming from your COMPUTE blocks. I would suggest that you change your COMPUTE block code like this:
compute before _page;
line "--> 1";
endcomp;
compute AFTER sot;
line "-->2 ";
endcomp;
compute after CAT;
line "--> 3 ";
endcomp;
and run the code again to see whether your LINE statements are inserting too much white space.
Cynthia
Thank you so much for your response.
Please see below the data for the table on the proc report table above, I did the numbering on the output but I still get impoper spacing between title and output.
Sot,sort,cat,_NAME_,_LABEL_,_page,cnt,uc,cd,total,tempvar
2,1,Screened,COUNT,Frequency Count,1,1,28,104,132,0
2,2,Completed Screening Period,COUNT,Frequency Count,1,2,28,104,132,0
4,3,Full Analysis Population,COUNT,Frequency Count,1,3,28,105,133,0
6,4,Completed Study,COUNT,Frequency Count,1,4,19,79,98,0
6,5,Premature Termination,COUNT,Frequency Count,1,5,9,25,34,0
8,6,Reason for Premature Termination,COUNT,Frequency Count,1,6,,,,0
8,6.2,Adverse Event : AE Number:,COUNT,Frequency Count,1,7,2,10,12,0.2
8,6.2,Lost to Follow-up,COUNT,Frequency Count,1,8,1,4,5,0.2
8,6.2,"Other, specify:",COUNT,Frequency Count,1,9,6,6,12,0.2
8,6.2,Request from PI/Sponsor,COUNT,Frequency Count,1,10,0,1,1,0.2
8,6.2,Withdrew Consent,COUNT,Frequency Count,1,11,0,4,4,0.2
8,6.3,TOTAL,COUNT,Frequency Count,1,12,9,25,34,0.3
Hi: Are you trying to reduce the cyan highlighted space, the yellow space or the pink space in the screen shot below?
The cyan line looks like it is one carriage return or one line after TITLE2. In my output, the size of that line is 12pt. With ODS RTF, I do not believe you can reduce that line. You might need to switch to TAGSETS.RTF so you can use PARSKIP as suggested earlier.
Here's how you would get rid of the italic on the column headers:
BTW, your COMPUTE AFTER CAT is never being executed because the usage of CAT is DISPLAY. You can only write LINE output at a break and you can only break on GROUP or ORDER variables. With CAT as a DISPLAY variable you should be seeing a note in the log that you can only break on GROUP or ORDER variables.
Cynthia
HI:
Here's an example of what happens with TAGSETS.RTF and a template change to PARSKIP:
To invoke the destination, instead of ODS RTF, you use ODS TAGSETS.RTF as shown below:
Then the PROC REPORT code was mostly the same with a few changes -- deleted the cellheight for the header:
More define statements and COMPUTE blocks (deleted the compute after CAT):
The close for the destination:
You don't need the BODYTITLE option because the title always goes into the body of the document with TAGSETS.RTF.
Hope this helps you get what you want.
Cynthia
Hi:
You have nodate and nonumber in your system options. That turns off page numbering. I didn't see you using any of the other ODS ESCAPECHAR controls that would do page numbering, so you'll either need to change NONUMBER to NUMBER in the OPTIONS statement or you'll have to use the ESCAPECHAR function for {thispage} to put the page number in a title or footnote.
Most people insert items like special totals or numbers into the header using SAS Macro variables. Here's an example using SASHELP.CLASS with AGE as a group item and SEX as the across item and I want the value of SEX, either M or F to display the count. And I want the overall count displayed. I used PROC MEANS to get the individual counts for each value of SEX and then I made macro variables:
You can see how I used the {thispage} function to get the page number into the output file. And I have the N for each value of SEX and the overall N in the headers.
Cynthia
Cynthia i am trying to output a table like this, i am struggling with creating the line in the circled section. Also my column appear to be too wide than the category colmn. Please advise
Hi;
The underline is easy with the TEXTDECORATION style override, as shown below:
Regarding the column widths, I recommend NOT trying to over-control the column widths. I did notice that you had a lot of cellwidths in your original program. I would recommend taking them ALL out. See what ODS is doing by default, if you need one column to be wider, then change that one. Don't change them all.
My paper on Creating Complex Reports may help you. I have 3 different examples of doing this type of demographic report. Go here to the support.sas.com site for papers https://support.sas.com/rnd/papers/#SGF2008 and scroll down to the 2008 papers then look for the title. You'll find the paper and zip file of programs there.
Cynthia
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.