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;
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.
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.
I tried all of the LISTING file types here, none of which resulted in a transpararent graph in powerpoint.
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.
Thanks! That's good to know.
Save $250 on SAS Innovate and get a free advance copy of the new SAS For Dummies book! Use the code "SASforDummies" to register. Don't miss out, May 6-9, in Orlando, Florida.
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.
Ready to level-up your skills? Choose your own adventure.