BookmarkSubscribeRSS Feed
Quentin
Super User

Hi,

I'm using SGRENDER to output a box plot to RTF, and consumers want easy cut-paste to PowerPoint.   (Don't have 9.4 yet, so can't try ODS to powerpoint).  I'm using  imagefmt=EMF.

I have TITLE statements for my titles.

Titles are going to the header of the RTF document, so cut-paste is a hassle for users.  I thought "no problem, I'll just set GTITLE on the ODS statement".  But while that would do what I want for SGPLOT, it doesn't effect SGRENDER.

Looks like if I want the titles in the image with SGRENDER, I need to switch from using title statements to using ENTRYTITLE in the GTL, is that right?

My other thought to (save all of my title statements), was to turn on BODYTITLE.  So the title would not be part of the image, but since it's in the body of the rtf, it's easier to cut-paste.  But at least with Office 2003, while the RTF document looks good in word (titles centered above the image), when I paste it into powerpoint the title text goes into a text box separate from the image, and is left aligned.

So my questions:

1.  Using SGRENDER, is there a way to get titles defined on a TITLE statement to be printed in the image?

2.  If not, any other suggestions for managing title text when generating RTF that will eventually end up in PowerPoint?

Thanks,

--Q.

proc template;
  define statgraph MyBoxPlot;
    begingraph;
      layout overlay ;     
        boxplot x=Region y=Sales ; 
      endlayout;
    endgraph;
  end;
run;

ods graphics/reset=all;
ods _all_ close;
ods rtf file="d:\junk\me.rtf" gtitle ;

title1 "This is a title";
title2 "I am a subtitle";

proc sgrender data=sashelp.shoes template="MyBoxPlot" ;
run;

proc sgplot data=sashelp.shoes;
  vbox sales/group=region;
run;

title1;
ods _all_ close;
ods listing;
BASUG is hosting free webinars Next up: Mike Sale presenting Data Warehousing with SAS April 10 at noon ET. Register now at the Boston Area SAS Users Group event page: https://www.basug.org/events.
2 REPLIES 2
DanH_sas
SAS Super FREQ

For question #1, I can definitely tell you that you cannot use TITLE/FOOTNOTE statements with GTL/SGRENDER. However, TITLE/FOOTNOTE statements will work with SG procedure output (SGPLOT/SGPANEL/SGSCATTER). The underlying rendering system is the same, so if the plot you're creating does not require a GTL-only option, I would use the SG procedures to solve both of your problems. However, if you require GTL, you can use ENTRYTITLE/ENTRYFOONOTE statements in the template to define your text. I would also make the text dynamic so that you can pass it into SGRENDER. Here is an example using your code:

proc template;

  define statgraph MyBoxPlot;

    dynamic TITLE1 TITLE2;

    begingraph;

      entrytitle TITLE1;

      entrytitle TITLE2;

      layout overlay ;    

        boxplot x=Region y=Sales ;

      endlayout;

    endgraph;

  end;

run;

proc sgrender data=sashelp.shoes template="MyBoxPlot" ;

dynamic TITLE1="This is a title";

dynamic TITLE2="I am a subtitle";

run;

Hope this helps!

Dan

Quentin
Super User

Thanks Dan,

Building off of your suggestion to make the title text dynamic, maybe I'll play with a macro function solution that would read the title text from sashelp.vtitle, and generate the dynamic statement for me.

so end up with:

proc sgrender data=sashelp.shoes template="MyBoxPlot";

  %MakeDynamicTitles()   /*read titles from sashelp.vtitle and generate one DYNAMIC statement for each*/

run;

Could be useful when you have titles defined for tables, and want them to be honored for plots.

But actually, since I'm already passing the titles in a macro call, I can just do:

proc sgrender data=sashelp.shoes template="MyBoxPlot";

  dynamic TITLE1="&title1";

run;

Thanks,

--Q.

BASUG is hosting free webinars Next up: Mike Sale presenting Data Warehousing with SAS April 10 at noon ET. Register now at the Boston Area SAS Users Group event page: https://www.basug.org/events.

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
  • 2868 views
  • 6 likes
  • 2 in conversation