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]