Graphics Programming

Data visualization using SAS programming, including ODS Graphics and SAS/GRAPH. Charts, plots, maps, and more!
BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
mathias
Quartz | Level 8

Hello,

I have trouble inserting the title of an sgplot into the png image, even with ods gtitle option.

(The SAS/GRAPH gmap has titles inserted into the png, but the ODS GRAPHICS sgplot does not.)

Any idea what I might be missing ?

Thank you !

Here the relevant sample code.

ods html

    path="&graphPath"

    device=png image_dpi=100

    file='file.html' body='body.html'

  style=&style gtitle gfootnote

  ;

(...)

  /* ODS GRAPHICS */

  ods graphics on /

    reset

    noborder

    imagename="bigHist_&Subject"

    height=200mm

    width=323.6mm ;

    title "%trim(%sysfunc(putc(&Subject,code2displayName.)))";

    title1 "%trim(%sysfunc(putc(&Subject,code2displayName.)))";

    proc sgplot data=bigHsitogramDS ;

      vbar Week / response=CasesYear0

        barwidth=1 nooutline transparency=.2

        name="vbar" legendlabel="Present" ;

      vline Week / response=CasesYear12 stat=mean

        lineattrs=(pattern=solid thickness=2) transparency=.2

        name="vline2" legendlabel="Past (mean of 2 years smoothed)" ;

  

      refline %sysfunc(week(&lastInterval,W)) / axis=x

        label="This Week";

      keylegend /  ;

      yaxis label="Weekly Reported Cases" integer min=0 grid /*values=(0 to 10 by 10)*/;

      xaxis display=(nolabel) type=discrete ;

      run;

   

(...)

  /* SAS/GRAPH */

  goptions reset=all goutmode=replace device=png cback=white noborder hsize=12cm vsize=4cm;

  * define the choro map color ;

  pattern color=CXD6E1F1;

  * create the graph ;

  title;

  proc gmap map=common.BEMAP_PROVINCES data=common.BEMAP_PROVINCES anno=annotateDS density=1   ;

    id NIS1_5;

    choro DENSITY /

      levels=1 statistic=first missing

      coutline=black woutline=1 nolegend

      name="miniMap_&Subject";

    run;quit;

  * reset ;

  pattern;

(...)

ods html close;

1 ACCEPTED SOLUTION

Accepted Solutions
ChrisHemedinger
Community Manager

Are you running this in SAS Enterprise Guide?  If so, the "auto" ODS statements that EG generates might be pre-empting your GTITLE directives.  Try turning off the normal ODS wrapper for EG when specifying your custom ODS statements, per this post:

Take control of ODS results in SAS Enterprise Guide - The SAS Dummy

Chris

Register for SAS Innovate 2025!! The premier event for SAS users, May 6-9 in Orlando FL. Sign up now for the best deals!

View solution in original post

3 REPLIES 3
ChrisHemedinger
Community Manager

Are you running this in SAS Enterprise Guide?  If so, the "auto" ODS statements that EG generates might be pre-empting your GTITLE directives.  Try turning off the normal ODS wrapper for EG when specifying your custom ODS statements, per this post:

Take control of ODS results in SAS Enterprise Guide - The SAS Dummy

Chris

Register for SAS Innovate 2025!! The premier event for SAS users, May 6-9 in Orlando FL. Sign up now for the best deals!
mathias
Quartz | Level 8

Thank you,

Yes I'm using EG.

And checking "Customize results formats (...)" did the job.

Is there any way of doing this with code ?

Thanks !

ChrisHemedinger
Community Manager

Assuming that you are using the default EG settings (SAS Report output), add this to the top of your code:

ods tagsets.sasreport13(id=EGSR) gtitle gfootnote;

Chris
Register for SAS Innovate 2025!! The premier event for SAS users, May 6-9 in Orlando FL. Sign up now for the best deals!

sas-innovate-white.png

Our biggest data and AI event of the year.

Don’t miss the livestream kicking off May 7. It’s free. It’s easy. And it’s the best seat in the house.

Join us virtually with our complimentary SAS Innovate Digital Pass. Watch live or on-demand in multiple languages, with translations available to help you get the most out of every session.

 

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
  • 3 replies
  • 5569 views
  • 2 likes
  • 2 in conversation