BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
rpaulus
Obsidian | Level 7


I'm in the process of overhauling standard survival graph programming where I work, getting away from PROC GPLOT and massive ANNOTATE datasets to add additional information which the statisticians want to have included.  I am moving instead to PROC TEMPLATE and SGRENDER-based programming instead since it is so much more simple.  I'm having some issues, though, with the PNG files that SGRENDER is producing when I import them into powerpoint.  Our group has a standard slide template, and it is expected that the survival graph will be transparent, allowing the slide template to show through.  However, the PNG file is not transparent - it's a big white box.  I've tried specifying OPAQUE=FALSE in the statgraph template I've made, as well as augmenting the DEFAULT style template to use in the ODS LISTING line I have right before the PROC SGRENDER statement.  None of this is making the PNG file be transparent when imported into powerpoint.  I'm not terribly adept at working with style templates, so I could easily have messed that up.  The following are my graph & style templates, followed by the SGRENDER statement.

Any tips on how to get that PNG file transparent in the powerpoint file and have it transparent so the powerpoint slide template shows through?

    proc template;

        define statgraph SURVIVAL_GRAPH;

            begingraph;

                layout lattice / rows=1 columns=1 opaque=false;

                    layout overlay / xaxisopts=(linearopts=(tickvaluelist=(0 3 6 9 12 15 18 21 24) viewmax=24))

                                     yaxisopts=(linearopts=(tickvaluelist=(0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1.0) viewmin=0));

                        stepplot x=time y=survival /  group = stratum name='survgraph';

                        scatterplot x=time y=censored /  group=stratum markerattrs=(symbol=plus);

                        innermargin / align=bottom;

                            blockplot x=tatrisk block=atrisk / class="stratum" display=(values label) valueattrs=(size=8)

                                      valuehalign=start;

                        endinnermargin;

                        discretelegend 'survgraph' / location = inside halign=center valign=bottom;

                    endlayout;

                    columnheaders;

                        layout overlay / pad=(top=5);

                        layout gridded / columns=7 border=true;

                            entry " ";

                            entry halign = center "# of Patients";

                            entry halign = center "Dead";

                            entry halign = center "Censored";

                            entry halign = center " ";

                            entry halign = center "Median Survival (95% CI)";

                            entry halign = center "Hazard Ratio (95% CI)";

*...ADDITIONAL LINES NOT SHOWN....;

                        endlayout;

                        endlayout;

                    endcolumnheaders;

                endlayout;

            endgraph;

        end;

    run;

proc template;

    define style journal_transparent;

      parent = Styles.Journal;

        style graphbackground from graphbackground/ transparency = 1.00;

        style GraphLegendBackground from GraphLegendBackground/ transparency = 1.00;

        style GraphCharts from GraphCharts /    transparency = 1.00;

        style GraphLegendBackground from GraphLegendBackground / transparency = 1.00;

        style GraphDataDefault from GraphDataDefault / transparency = 1.00;

        style graphdata1 from graphdata1 / transparency = 1.00;

        style graphdata2 from graphdata2 / transparency = 1.00;

    end;

run;

ods graphics / reset imagename = "survival graph" IMAGEFMT=png ANTIALIAS=off;

option orientation = landscape;

ods listing image_dpi = 300 GPATH="&directory\sas output" style=journal_transparent;

     proc sgrender data=_survivalplotdata template=SURVIVAL_GRAPH;

     run;

1 ACCEPTED SOLUTION

Accepted Solutions
Jay54
Meteorite | Level 14

SG Procedures (or GTL) do not support the creation of transparent PNG files.  Please log your new feature request to Tech Support using the link (Submit a problem report) in the footer of this page. As a work around, you can use an image as a background annotation.

View solution in original post

4 REPLIES 4
boschy
Fluorite | Level 6

I seem to remember that Office products may not support PNG transparency. Web browsers do, and even then, not all of them do.

Try producing a GIF image instead of PNG.

I always produce PNG for web content, but have not tried to create transparent images for MS Office.

rpaulus
Obsidian | Level 7

I tried all of the LISTING file types here, none of which resulted in a transpararent graph in powerpoint.

Jay54
Meteorite | Level 14

SG Procedures (or GTL) do not support the creation of transparent PNG files.  Please log your new feature request to Tech Support using the link (Submit a problem report) in the footer of this page. As a work around, you can use an image as a background annotation.

rpaulus
Obsidian | Level 7

Thanks!  That's good to know.

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
  • 4 replies
  • 2046 views
  • 0 likes
  • 3 in conversation