BookmarkSubscribeRSS Feed
KarenES
Calcite | Level 5
My ODS RTF continues to provide 0.05 instead of 0.5 margin widths. I have tried to change this through proc template and options with no success. The top and bottom margins work just fine and I can change them as needed.

Below is the template code (from p. 432 ODS Basics and Beyond)

Proc template;
Define style RTFmargins;
Parent = styles.rtf;
Style body from body/
bottommargin = .5in Topmargin=.5in leftmargin=.5in rightmargin=.5in;
End;
run;

Here is the code used to create the RTF. I am using WORD 2007 to open and edit the RTF.


ODS Escapechar = '~';

ODS RTF FILE= 'S:\...\item frequencies.rtf'
startpage=no keepn contents=yes TOC_DATA Style=journal sasdate;
ODS noptitle;
ods proclabel ' ';
footnote justify=center 'Page ~{thispage} of ~{lastpage}';

options nonumber /*supresses automatic page number at top of output*/
topmargin = '.5in' bottommargin = '.5in' leftmargin = '1in' rightmargin = '1in';


Thank you in advance for any assistance,
Karen
2 REPLIES 2
Cynthia_sas
SAS Super FREQ
Hi:
I do not have SAS 9.1.3 or Office 2007 to test with anymore, but either of these 3 techniques works for me in SAS 9.2 with Office 2007:

Basic) Just use SAS Options -- in my code below, I use options with the JOURNAL style (using SAS Options directly with RTF did not work in SAS 8, for example, you had to make a template change)

1) change the template to have margin values and do NOT use the OPTIONS for margin

2) Explicitly _UNDEF_ the margin values in the template and DO use SAS OPTIONS for margin values in my code

All of these methods are shown below. All the code in our ODS book was tested in SAS 9.2 -- we did not go back and test code in SAS 9.1.3, but I believe that if these methods do not work in SAS 9.1.3, that at least the #1 and #2 method should work. Lauren wrote this paper for SAS 8.2 and early SAS 9 that outlined the #1 and #2 technique:
http://www2.sas.com/proceedings/sugi29/125-29.pdf

Perhaps you're running into something related to this issue???
http://support.sas.com/kb/10/112.html

Otherwise, if you run program #1 and #2 and neither of them result in the desired margins (you're still getting a margin of .05) then you may have a corrupted NORMAL.DOT file or some other problem with Microsoft Word.

In that case, you may want to work with Tech Support on this issue. (Note, in the code below, I made my margins 4 distinct values for #1 and #2, each time, so you could quickly see each margin's value in the Word Page Layout window.)

cynthia
[pre]
** Basic Method -- use ONLY options;
** make sure SAS options are not interfering and are set to;
** something DIFFERENT than I will put in the template;
options bottommargin = 1.0in
Topmargin=1.0in
leftmargin=1.0in
rightmargin=1.0in;

ODS Escapechar = '~';

ODS RTF FILE= 'c:\temp\testmargin_base.rtf'
startpage=no keepn contents=yes TOC_DATA Style=journal sasdate;
ODS noptitle;
ods proclabel ' ';
footnote justify=center 'Page ~{thispage} of ~{lastpage}';

options nonumber;

proc print data=sashelp.shoes(obs=200);
title 'Base) use Options and style=journal';
title2 'to check "baseline" for margins with just SAS options';
var region product sales;
run;
ods rtf close;


*** Method #1 -- put margin values in the style template and ONLY;
*** in the style template;
ods path work.tmp(update) sasuser.templat(update)
sashelp.tmplmst(read);

Proc template;
Define style RTFmargins;
Parent = styles.rtf;
Style body from body/
bottommargin = 1.5in
Topmargin=1.15in
leftmargin=1.25in
rightmargin=1.35in;
End;
run;


ODS Escapechar = '~';

ODS RTF FILE= 'c:\temp\testmargin1.rtf'
startpage=no keepn contents=yes TOC_DATA Style=rtfmargins sasdate;
ODS noptitle;
ods proclabel ' ';
footnote justify=center 'Page ~{thispage} of ~{lastpage}';

options nonumber;

proc print data=sashelp.shoes(obs=200);
title '1) change margins in template';
title2 'check page layout to see "different" margin sizes';
var region product sales;
run;
ods rtf close;




*** Method #2 -- essentially turn off margin values in the template;
*** with _UNDEF_ and specify margins in SAS Options;
ods path work.tmp(update) sasuser.templat(update)
sashelp.tmplmst(read);

Proc template;
Define style RTF_undef;
Parent = styles.rtf;
Style body from body/
bottommargin = _undef_
Topmargin=_undef_
leftmargin=_undef_
rightmargin=_undef_;
End;
run;

** again, use options to make each margin a unique size;
options bottommargin = .5in
Topmargin=1.5in
leftmargin=2.0in
rightmargin=2.5in;


ODS Escapechar = '~';

ODS RTF FILE= 'c:\temp\testmargin2.rtf'
startpage=no keepn contents=yes TOC_DATA Style=rtf_undef sasdate;
ODS noptitle;
ods proclabel ' ';
footnote justify=center 'Page ~{thispage} of ~{lastpage}';

options nonumber;

proc print data=sashelp.shoes(obs=200);
title '2) change margins in options with _undef_ in template';
title2 'check page layout to see "different" margin sizes';
var region product sales;
run;
ods rtf close;

[/pre]
KarenES
Calcite | Level 5
Hi Cynthia,

I tried your suggestions, plus the ones in the paper and from the website link. It seems to be more of a MSword issue. Once that file is replaced, then I will test again.

Thank you for your help and examples.

Karen S

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 2 replies
  • 3452 views
  • 0 likes
  • 2 in conversation