BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
louisehadden
Quartz | Level 8

I know that ODS EXCEL does not do preimage and postimage in titles and footnotes, and suspect that ODS WORD may be the same. Can anyone confirm and suggest a work around that isn't a Unicode font? TIA.

1 ACCEPTED SOLUTION

Accepted Solutions
Ksharp
Super User
/*You could use "proc odstext" instead of TITLE statement*/
options validvarname=any validmemname=extend nodate nonumber leftmargin=1.91cm rightmargin=1.91cm topmargin=2.54cm bottommargin=2.54cm  ; 
data 签署知情同意书;
infile cards truncover;
input a :$30. b $200.;
cards;
签署知情同意书   .
签署知情同意书日期	~{style [FONTFAMILY='Times New Roman Uni']|__|__|__|__|}年~{style [FONTFAMILY='Times New Roman Uni']|__|__|}月~{style [FONTFAMILY='Times New Roman Uni']|__|__|}日
;

ods path work.template(update) sashelp.tmplmst;
proc template;
define style styles._journal;
parent=styles.word;  
class table / margintop=20 rules=all frame=box NOBREAKSPACE=OFF outputwidth=100%  cellpadding=10 cellspacing=0 FONTFAMILY='宋体' just=l; /*cellpadding=0 cellspacing=0*/
style header from header / background=black;
end;
run;
title;
ods escapechar='~';
ods _all_ close;
ods word file="c:\temp\want.docx" style=_journal startpage=no;
proc odstext PAGEBREAK= No contents="" ;
h2 "签署知情同意书" / style={just=l color=black  fontweight=bold FONTFAMILY='宋体' fontsize=0.50cm preimage='c:\temp\sas.png' };  /*<----*/
run ;
data _null_; 
  set 签署知情同意书 end=last; 
    if _N_ = 1 then do; 
      dcl odsout obj(); 
      obj.table_start(); 
    end;
  ** row for every obs;
      obj.row_start(); 
  if _n_=1 then  obj.format_cell(data: a,column_span:2, style_attr:"fontweight=bold FONTFAMILY='宋体' fontsize=0.50cm background=graybb just=l" ); 
    else do;
      obj.format_cell(data: a, column_span:1, style_attr:"FONTFAMILY='宋体' fontsize=0.38cm vjust=m just=l "); 
      obj.format_cell(data: b, column_span:1, style_attr:"FONTFAMILY='宋体' fontsize=0.38cm vjust=m just=l  "); 
	end;
      obj.row_end(); 
   
  if last then do; 
      obj.table_end(); 
    end; 
run;
ods word close;

Ksharp_0-1698665457320.png

 

View solution in original post

2 REPLIES 2
Cynthia_sas
SAS Super FREQ

Hi:

  Do you mean BODYTITLE vs EMBEDDED_TITLES? I think the EMBEDDED_TITLES is unique to ODS EXCEL. ODS RTF has the BODYTITLE option and ODS WORK has the sub-option BODY_TITLE='ON'.

Cynthia

Ksharp
Super User
/*You could use "proc odstext" instead of TITLE statement*/
options validvarname=any validmemname=extend nodate nonumber leftmargin=1.91cm rightmargin=1.91cm topmargin=2.54cm bottommargin=2.54cm  ; 
data 签署知情同意书;
infile cards truncover;
input a :$30. b $200.;
cards;
签署知情同意书   .
签署知情同意书日期	~{style [FONTFAMILY='Times New Roman Uni']|__|__|__|__|}年~{style [FONTFAMILY='Times New Roman Uni']|__|__|}月~{style [FONTFAMILY='Times New Roman Uni']|__|__|}日
;

ods path work.template(update) sashelp.tmplmst;
proc template;
define style styles._journal;
parent=styles.word;  
class table / margintop=20 rules=all frame=box NOBREAKSPACE=OFF outputwidth=100%  cellpadding=10 cellspacing=0 FONTFAMILY='宋体' just=l; /*cellpadding=0 cellspacing=0*/
style header from header / background=black;
end;
run;
title;
ods escapechar='~';
ods _all_ close;
ods word file="c:\temp\want.docx" style=_journal startpage=no;
proc odstext PAGEBREAK= No contents="" ;
h2 "签署知情同意书" / style={just=l color=black  fontweight=bold FONTFAMILY='宋体' fontsize=0.50cm preimage='c:\temp\sas.png' };  /*<----*/
run ;
data _null_; 
  set 签署知情同意书 end=last; 
    if _N_ = 1 then do; 
      dcl odsout obj(); 
      obj.table_start(); 
    end;
  ** row for every obs;
      obj.row_start(); 
  if _n_=1 then  obj.format_cell(data: a,column_span:2, style_attr:"fontweight=bold FONTFAMILY='宋体' fontsize=0.50cm background=graybb just=l" ); 
    else do;
      obj.format_cell(data: a, column_span:1, style_attr:"FONTFAMILY='宋体' fontsize=0.38cm vjust=m just=l "); 
      obj.format_cell(data: b, column_span:1, style_attr:"FONTFAMILY='宋体' fontsize=0.38cm vjust=m just=l  "); 
	end;
      obj.row_end(); 
   
  if last then do; 
      obj.table_end(); 
    end; 
run;
ods word close;

Ksharp_0-1698665457320.png

 

sas-innovate-wordmark-2025-midnight.png

Register Today!

Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.


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.

SAS Training: Just a Click Away

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

Browse our catalog!

Discussion stats
  • 2 replies
  • 842 views
  • 0 likes
  • 3 in conversation