BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
ybz12003
Rhodochrosite | Level 12

Hello,

I have PROC PRINT statement below.  Because I would like to print out a lof of variables, it took two lines to print out one ID.    Although I have used 'landscape' option in 'RTF'  ODS,  the MS WORD printed out two lines.   Is there a way to enforce all the columns into one line while outputing?  Thanks. 

 

ods rtf file = "Pathway.rtf"
style=atc sasdate;
 
options orientation=landscape;
proc print data=test;
	var repeat_id id studysite date Sex DOB county zipcode   Race1_12 totppl check 
	    site_repeat check_n site_repeat_n;
	format county $25.;
	by studysite;
run;

ods rtf close;

 

1 ACCEPTED SOLUTION

Accepted Solutions
ballardw
Super User

You can try adding a PAPERSIZE option to the options statement to use a different size of paper.

The syntax for a custom paper size is Papersize (widthvalue,heightvalue). So Papersize(11in,17in) would use a logical page of 11 by 17. Which your Landscape would turn into 17in wide and 11in tall. So lines should be longer.

 

I think you want to set this, and possibly the orientation before the ODS RTF, at least that seemed to be more consistent for output when I have used the Papersize option.

 

Other options would be to reduce the fontsize used by the style or in overrides in Proc Print to reduce the length of strings. You may want to investigate margins as well. The system options leftmargin, Rightmargin, Topmargin and Bottommargin can change the amount of the page used.

View solution in original post

3 REPLIES 3
Reeza
Super User
You'll need to play with the font size and spacing.

ODS EXCEL has a scaling option but ODS RTF does not so you need to manually fit it to the page.

I used to use this style to ensure that my data would fit. You can use it a starter and then adjust your font and font size as needed to get it all in one line.

https://gist.github.com/statgeek/9603140

ballardw
Super User

You can try adding a PAPERSIZE option to the options statement to use a different size of paper.

The syntax for a custom paper size is Papersize (widthvalue,heightvalue). So Papersize(11in,17in) would use a logical page of 11 by 17. Which your Landscape would turn into 17in wide and 11in tall. So lines should be longer.

 

I think you want to set this, and possibly the orientation before the ODS RTF, at least that seemed to be more consistent for output when I have used the Papersize option.

 

Other options would be to reduce the fontsize used by the style or in overrides in Proc Print to reduce the length of strings. You may want to investigate margins as well. The system options leftmargin, Rightmargin, Topmargin and Bottommargin can change the amount of the page used.

PGStats
Opal | Level 21

Sometimes, all it takes is to reduce the width of some columns headings by splitting them over two or more lines, for example:

 

proc print data=test label split="/";
    label repeat_id="Repeat/Id" studysite="Study/Site"; 
	var repeat_id id studysite date Sex DOB county zipcode   Race1_12 totppl check 
	    site_repeat check_n site_repeat_n;
	format county $25.;
	by studysite;
run;
PG

hackathon24-white-horiz.png

The 2025 SAS Hackathon Kicks Off on June 11!

Watch the live Hackathon Kickoff to get all the essential information about the SAS Hackathon—including how to join, how to participate, and expert tips for success.

YouTube LinkedIn

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
  • 3 replies
  • 919 views
  • 2 likes
  • 4 in conversation