BookmarkSubscribeRSS Feed
Corinthian94
Obsidian | Level 7

Hi all,

 

I am trying to create a SAS report that has some pages with 2 columns with one centered header for the section. Code and output below:

 

ods pdf startpage = now;
ods pdf columns = 2;
ODS TEXT = "~{newline 1}";
ODS TEXT = "~{STYLE[JUST = C FONTWEIGHT = BOLD FONTSIZE = 12PT]Study Stop}";
ODS TEXT = "~{newline 1}"; 
 
proc sort data=current.status_file; by descending stop_date; run;
PROC REPORT DATA = current.status_file NOWD HEADLINE BOX SPLIT = "\";
column study_id stop_date ss_reason ssreas_othersp withdraw_reason;
where ss_reason ne .;
 
define study_id / center "ID";
define stop_date / center order = internal "Stop Date" format = MMDDYY10.;
define ss_reason / display center "Reason" format=ss.;
define ssreas_othersp / display center "Other reason";
define withdraw_reason / display center "Withdrawal Reason";
 
run;
ods pdf close;

 

Corinthian94_0-1722521145713.png

 

I am able to get two columns using ODS PFF columns=2, but this then puts the header over the first column instead of at the center at the top of the page. Is there a way to center this in the middle of the two columns? I have tried to find something but have not had any luck, and anything I try gets rid of the two columns which is more important for the formatting than the title being in the middle. Thanks in advance for your help!

4 REPLIES 4
Ksharp
Super User

Can't you use TITLE statement ?

 

data have;
 set sashelp.heart(obs=100);
 keep sex height;
run;

title 'xxxxxxxxxx';
options nodate nonumber;
ods pdf file='c:\temp\temp.pdf' columns=2 startpage=no;
proc report data=have nowd;
run;
ods pdf close;


Ksharp_0-1722568924286.png

 

Corinthian94
Obsidian | Level 7

Thanks for this! Sorry this is so late - this is part of a larger report that has titles on each page, so the title statement is already used for something else at the beginning of the report. I need this specific page to have two columns and a centered header (my code for this page is below). Is there a way to make the title for just this paged centered? Thanks! 

 

ods pdf startpage = now;
ODS TEXT = "~{newline 1}";
ODS TEXT = "~{STYLE[JUST = C FONTWEIGHT = BOLD FONTSIZE = 12PT]Study Stop}";
ODS TEXT = "~{newline 1}"; 
 
PROC REPORT DATA = file NOWD HEADLINE BOX SPLIT = "\";
column var var2 ss_reason ssreas_othersp withdraw_reason;
where ss_reason ne .;
 
define var / center "ID";
define var2 / center order = internal "Stop Date" format = MMDDYY10.;
define ss_reason / display center "Reason" format=ss.;
define ssreas_othersp / display center "Other reason";
define withdraw_reason / display center "Withdrawal Reason";
 
run;
 
ods pdf close;
Ksharp
Super User

Nope. I have no idea about it. Maybe @Cynthia_sas  could give you a hand.

Cynthia_sas
SAS Super FREQ
Hi: If you're going to use ODS TEXT, and you want to change the style from the default placement I believe you need to change the style template used for the output. There's an example of doing this in the documentation https://go.documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/odsug/p14gx25pepks6dn1q9m7vkq3gfoi.htm#n0r...
Cynthia

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

How to Concatenate Values

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 4 replies
  • 567 views
  • 0 likes
  • 3 in conversation