BookmarkSubscribeRSS Feed
jteres
Obsidian | Level 7

I'm having an issue with titles in my RTF output when I use PROC SGPLOT.

For example, the following code (which has been modified to protect the identities of innocent file paths):

filename test "rtf_title_test1.rtf"

ods rtf file = test bodytitle sasdate startpage = yes style = journal ;

title "Height by Weight" ;

proc sgplot data = sashelp.class ;

     xaxis type = linear ;

     series x = weight y = height ;

run ;

Works, except that there is no title in my output. I'm using SAS EG 4.3 and SAS 9.2. When I eneable the default EG RTF destination, rather than using ODS statements, the title appears. But with the ODS statement, it's gone.

Any ideas?

Thanks,

Jed

9 REPLIES 9
Reeza
Super User

Check the header in your RTF file. By default, ODS RTF places the title in the header.

Cynthia_sas
SAS Super FREQ

Hi:

  As Reeza mentioned, by default, ODS RTF places the SAS title in the header of the Word document. The exception to this rule is graph output, where the title is generally placed within the boundary of the image.

  I find it best to explicitly specify 1) where I want the titles to be placed for graph purposes -- either inside the image (GTITLE) or outside the image (NOGTITLE). And, then, once that decision is made, if I want the title INSIDE the image, then there's nothing for BODYTITLE to do. IF i want the title OUTSIDE the image, then using BODYTITLE with NOGTITLE will do what you want. When I ran this code in SAS 9.3, I got the results I think you want with #2 code. #1 code gives me the TITLE in the header of the RTF document. #3 and #4 code gives me the title inside the image boundary, where ODS cannot really touch it.

  The only problem is that I no longer have SAS 9.2 to test with. So if this code doesn't work for you in SAS 9.2, it might be because the NOGTITLE/GTITLE option was not implemented in ODS RTF until SAS 9.3 version. But I think that GTITLE/NOGTITLE was first implemented for HTML and RTF at the same time and implemented for PDF later.

  At any rate, if this code doesn't work for you then you might want to work with Tech Support for more help. Also, EG may only show you 3 of the 4 output files. You may have to open one of the output files using Word instead of the EG results tabs. EG doesn't show you all the results.

cynthia

  

ODS _ALL_ CLOSE;
** close all EG destinations;  
  
options nodate nonumber;
 
ods rtf file = "c:\temp\rtf_title_test1_nogtitle.rtf"
    style = journal nogtitle;
title "1) Use NOGTITLE" ;
proc sgplot data = sashelp.class ;
     xaxis type = linear ;
     series x = weight y = height ;
run ;
ods rtf close;
   
ods rtf file = "c:\temp\rtf_title_test2_nogtitle_bodytitle.rtf"
    style = journal nogtitle bodytitle;
title "2) Use NOGTITLE and BODYTITLE" ;
proc sgplot data = sashelp.class ;
     xaxis type = linear ;
     series x = weight y = height ;
run ;
ods rtf close;
   
ods rtf file = "c:\temp\rtf_title_test3_gtitle.rtf"
    style = journal gtitle;
title "3) GTITLE puts title -INSIDE- the image" ;
proc sgplot data = sashelp.class ;
     xaxis type = linear ;
     series x = weight y = height ;
run ;
ods rtf close;
   
ods rtf file = "c:\temp\rtf_title_test4_gtitle_bodytitle.rtf"
    style = journal gtitle bodytitle;
title "4) GTITLE and BODYTITLE does not make sense" ;
proc sgplot data = sashelp.class ;
     xaxis type = linear ;
     series x = weight y = height ;
run ;
ods rtf close;

CLiu
Calcite | Level 5

Hi Cynthia,

I think this also works the same for RTF files using SAS/GRAPH, like gplot.

Can you please confirm?

Thanks,

Charlie

Clarity
Calcite | Level 5

Cynthia,

I'm currently running into the same issue with PDF using gplot....I tried you work around and does not work on PDFs. Please note that I am on SAS 9.2 for windows

Cynthia_sas
SAS Super FREQ

Hi, as I explained over a year ago. I no longer have SAS 9.2 to test with. My recommendation is that you open a track with Tech Support. NOGTITLE/GTITLE was an option added to ODS PDF, but I am not sure when. Tech Support really is the place where you should ask this question, instead of adding a question onto a year old track.

cynthia

NovGetRight
Obsidian | Level 7

I use proc sgpanel , following your method, but title or footnote can't be insect into RTF' heaer or footer. they are just displayed on the graphic's wall,  can you tell me why?

Is it because: PROC sgpanel don't belong to GTL ?

Reeza
Super User

I think it depends on the ODS settings. Look into gtitle, and post your code if it doesn't work. 

You should also specify your version of SAS.

NovGetRight
Obsidian | Level 7

the code is quite long, my SAS VERSION is 9.4; i post part of them

options papersize=letter orientation=landscape nodate nonumber center missing=" " nobyline;
options noquotelenmax;
ODS _ALL_ CLOSE;
ods rtf style=styles.klgraph_1 file="&raw.boxplot.rtf" ;

title2 "Figure xxxxx";

footnote1 j=l "xxxxxxxxxxxxxxxxxxxxxxxx.";

proc sgpanel data = test  SUBPIXEL;
  panelby var1 / 
     COLHEADERPOS=top 
     HEADERATTRS=( Family="Times New Roman" Size=6.5 WEIGHT= BOLD )
     LAYOUT=COLUMNLATTICE  
     novarname  
     columns= 14
     ;
  vbox aval  /
     legendlabel =" A:sdsdsv  B:sdfsdfs"
     category = var2
     BOXWIDTH=0.6 
     groupdisplay=cluster
     meanattrs=(color=black  )
     medianattrs= (color=black  )
     fillattrs=(transparency=0.5 color=Olive)
     ;
  keylegend /
    NOBORDER
    position=bottom
    valueattrs=(size=8 FAMILY="Times New Roman")
    ;
  COLAXIS LABEL= "sssssssss"   valueattrs=(size=8 FAMILY="Arial") DISCRETEORDER=FORMATTED  FITPOLICY=NONE;
  ROWAXIS LABEL= "qqqq)" valueattrs=(size=8 FAMILY="Arial") ;

run;

ods rtf close;
ods listing;

Cynthia_sas
SAS Super FREQ
Please look at code example #1 in my posting of Feb 2013. You will need NOGTITLE to move the graph title OUTSIDE of the image.
cynthia

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

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
  • 9 replies
  • 10722 views
  • 3 likes
  • 6 in conversation