BookmarkSubscribeRSS Feed
Sisa
Calcite | Level 5

I want a title in the beginning of the word file, and a footnote in the end of the wordfile (not inside the graph borders). When I use the code below, there is no title produced (and no errors occur). I could not find the code for footnote. SAS 9.4 TS1M6

 

*Define mystyle;
proc template;
	define style mystyle;
	parent = styles.word;
	style body from body / background=white;
	style header from header/ background=white;

    style fonts /                                                           
         'TitleFont2' = ("Albany AMT",2,bold)                                                                
         'TitleFont' = ("Albany AMT",3,bold)                                                                    
         'StrongFont' = ("Albany AMT",2,bold)                                                                
         'EmphasisFont' = ("Albany AMT",2,italic)                                                              
         'FixedFont' = ("Albany AMT",2)                             
         'BatchFixedFont' = ("Albany AMT",2)                                                                   
         'FixedHeadingFont' = ("Albany AMT",2)           
         'FixedStrongFont' = ("Albany AMT",2,bold)       
         'FixedEmphasisFont' = ("Albany AMT",2,italic)   
         'headingEmphasisFont' = ("Albany AMT",2,bold italic)       
         'headingFont' = ("Albany AMT",2,bold)                                                                
         'docFont' = ("Albany AMT",2);     
      class GraphFonts /                                                      
         'GraphDataFont' = ("Albany AMT",7pt)               
         'GraphUnicodeFont' = ("Albany AMT",9pt)                  
         'GraphValueFont' = ("Albany AMT",9pt)              
         'GraphLabel2Font' = ("Albany AMT",10pt)            
         'GraphLabelFont' = ("Albany AMT",10pt,bold)        
         'GraphFootnoteFont' = ("Albany AMT",10pt,italic)   
         'GraphTitleFont' = ("Albany AMT",11pt,bold)        
         'GraphTitle1Font' = ("Albany AMT",14pt,bold)       
         'GraphAnnoFont' = ("Albany AMT",10pt);
	end;
run;

data cc8;
   input ch 1-4 arm $ lbtest $;
   datalines;  
0.28 TrtA ALP
0.30 TrtA ALP
0.33 TrtA ALP
0.24 TrtA ALP
0.45 TrtA ALP
0.54 TrtA ALP
0.58 TrtB ALP
0.30 TrtB ALP
0.33 TrtB ALP
0.26 TrtB ALP
0.45 TrtB ALP
0.34 TrtB ALP
;
run;

option nonumber nodate;

ods word file="H:\Boxplots.docx" style=mystyle title='Boxplots of clinical chemistry';
proc sgplot data=cc8;
 	vbox ch /group=arm; label ch="Change from baseline (unit)"; refline 0;
run;
ods _all_ close;
4 REPLIES 4
Cynthia_sas
SAS Super FREQ

Hi:

  The ODS style template changes the characteristics of the TITLE (or FOOTNOTE) that you insert into OUTPUT using a TITLE or FOOTNOTE statement.

 

  What you show in your code is a TITLE option on the ODS invocation statement -- that is NOT controlled by the style template. As you can see below, the TITLE="title string" that you place on the ODS statement goes into the document metadata -- as shown below:

title_inside_sandwich.png

 

Please use a regular TITLE statement:

title 'This is my title';

immediately above your SGPLOT statement or between the PROC SGPLOT and the RUN statements.

 

Hope this helps,

cynthia

MichaelL_SAS
SAS Employee

Looking at the documentation the ODS WORD statement, the title specified in the TITLE= option appears in the document properties. Using the example you provided I see 

 

docProp.png

 

I think instead you might want to use the TITLE and FOOTNOTE statements along with the NOGTITLE and NOGFOOTNOTE options in the ODS WORD statement to move the title and footnote out of the graph borders. 

 

So for example something like:

ods word file="H:\Boxplots.docx" style=mystyle nogtitle nogfootnote;
title 'Boxplots of clinical chemistry';
footnote 'footnote text';
proc sgplot data=cc8;
 	vbox ch /group=arm; label ch="Change from baseline (unit)"; refline 0;
run;
ods _all_ close;

 

Sisa
Calcite | Level 5

Thank you both. Is it possible to have a title both inside each graph window and one for the whole document? And the same for footnotes.

MichaelL_SAS
SAS Employee

Yes, here is an example in a previous communities post that creates footnotes and titles both in and outside of the graph walls. The example uses the SGANNO= option in PROC SGPLOT to add a title and a footnote within the plot window using an annotation data set.

 

For more examples of using annotation, there is this SAS Global Forum paper or Chapter 4 in this book. 

 

 

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
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
  • 4 replies
  • 1011 views
  • 1 like
  • 3 in conversation