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

Hello Everyone,

I am working on creating a powerpoint where my background is an image previously assigned with a template. The problem that I am encountering is when I add one of my graphics to the powerpoint. Currently the background is white. I have tried to change it to opaque but with no luck. I'm assuming it has something to do with the fact that the graph is being output to the powerpoint as an image. Is there anyway to assign a background image to the graph before it is output to the powerpoint? I have tried using iback= in my proc sgrender statement with no luck. Does anyone have any ideas?

proc template; 
define statgraph growth;
begingraph;
layout overlay /xaxisopts=(label=' ' display=(tickvalues))
				yaxisopts=(label=' ' display=(tickvalues))
				borderattrs=(color=white)
				walldisplay=none;
barchart x=grade_level y=ptarget /fillattrs=(color=CX4472C4) outlineattrs=(color=CX4472C4) barlabel=true barlabelattrs=(size=10pt)
		legendlabel='District Percent of Target' name='percent' barwidth=.38;
seriesplot x=grade_level y=one_year / lineattrs=(color=red pattern=4)
		legendlabel='Annual Target 100%' name='annual';
seriesplot x=grade_level y=low_mid / lineattrs=(color=tan pattern=2)
		legendlabel='National Low Mid Year' name='low';
seriesplot x=grade_level y=high_mid /lineattrs=(color=tan pattern=2)
		legendlabel='National High Mid Year' name='high';
discretelegend 'percent' 'annual' 'low' 'high'/ border=false location=outside valign=bottom displayclipped=true valueattrs=(size=10pt);
endlayout;
endgraph;
end;
run;

goptions reset=all iback="E:\Custom Reporting\2015 MOY Reporting\Appendix\Images for Appendix\growthbackground.jpg";
ods graphics /border=off imagefmt=png;
ods layout gridded rows=2 columns=2;
ods region row=1 column=1 height=4.5in width=7in;
title1 j=left bold height=22pt "Percent of Target Growth Achieved at &mathematics_weeks Weeks";
title2 " ";
proc sgrender data=slide5_13 template=growth;
where subject='Mathematics';
run;

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
DanH_sas
SAS Super FREQ

Sorry, the link is now invalid, but just search for the DRAWTEXT statement on the SAS support site.

 

Thanks!
Dan

View solution in original post

8 REPLIES 8
DanH_sas
SAS Super FREQ

Use OPAQUE=FALSE on the BEGINGRAPH statement to mke the graph background transparent. If you also want the walls transparent, use WALLDISPLAY=(outline) to keep the outline, but make the walls transparent. WALLDISPLAY=NONE makes them both go away.

 

Hope this helps!

Dan

Amber1331
Calcite | Level 5

Hi DanH_sas,

Thanks so much for your quick response. I tried adding this line to my code, however i receive the following error:

 

proc template; 
define statgraph growth;
begingraph / OPAQUE=FALSE;
layout overlay /xaxisopts=(label=' ' display=(tickvalues))
				yaxisopts=(label=' ' display=(tickvalues))
				borderattrs=(color=white)
				walldisplay=none;
barchart x=grade_level y=ptarget /fillattrs=(color=CX4472C4) outlineattrs=(color=CX4472C4) barlabel=true barlabelattrs=(size=10pt)
		legendlabel='District Percent of Target' name='percent' barwidth=.38;
seriesplot x=grade_level y=one_year / lineattrs=(color=red pattern=4)
		legendlabel='Annual Target 100%' name='annual';
seriesplot x=grade_level y=low_mid / lineattrs=(color=tan pattern=2)
		legendlabel='National Low Mid Year' name='low';
seriesplot x=grade_level y=high_mid /lineattrs=(color=tan pattern=2)
		legendlabel='National High Mid Year' name='high';
discretelegend 'percent' 'annual' 'low' 'high'/ border=false location=outside valign=bottom displayclipped=true valueattrs=(size=10pt);
endlayout;
endgraph;
end;
run;

 

ERROR 22-322: Syntax error, expecting one of the following: ;, ATTRPRIORITY, BACKGROUNDCOLOR, BORDER, BORDERATTRS,
COLLATION, DATACOLORS, DATACONTRASTCOLORS, DATALINEPATTERNS, DATASKIN, DATASYMBOLS, DESIGNHEIGHT,
DESIGNWIDTH, DRAWSPACE, INCLUDEMISSINGDISCRETE, PAD, SUBPIXEL.
ERROR 76-322: Syntax error, statement will be ignored.

 

Could it be the version I am using. I am currently working with SAS 9.4 TS Level 1M1. 

DanH_sas
SAS Super FREQ

Unfortunately, we added the OPAQUE option on BEGINGRAPH at SAS 9.4m3. However, you asked about adding an image to your graph background when you generate the graph. You can do that using the DRAWIMAGE statement (http://support.sas.com/documentation/cdl/en/grstatgraph/67882/HTML/default/viewer.htm#n1gyqh8pgqnccw... Be sure to set the size to be the size of your graph, and set LAYER=BACK. Let me know if this works for you.

 

Thanks!
Dan

DanH_sas
SAS Super FREQ

Sorry, the link is now invalid, but just search for the DRAWTEXT statement on the SAS support site.

 

Thanks!
Dan

Amber1331
Calcite | Level 5

Thanks Dan. This worked perfectly! Thanks so much for your quick response. 

Amber1331
Calcite | Level 5

Thanks again for all your help. I do have one more quesiton. The image worked, however I now have a white border around the image that I cannot seem to remove. 

proc template; 
define statgraph growth;
begingraph;
layout overlay /xaxisopts=(label=' ' display=(tickvalues))
				yaxisopts=(label=' ' display=(tickvalues))
				walldisplay=none;
barchart x=grade_level y=ptarget /fillattrs=(color=CX4472C4) outlineattrs=(color=CX4472C4) barlabel=true barlabelattrs=(size=10pt)
		legendlabel='District Percent of Target' name='percent' barwidth=.38;
seriesplot x=grade_level y=one_year / lineattrs=(color=red pattern=4)
		legendlabel='Annual Target 100%' name='annual';
seriesplot x=grade_level y=low_mid / lineattrs=(color=tan pattern=2)
		legendlabel='National Low Mid Year' name='low';
seriesplot x=grade_level y=high_mid /lineattrs=(color=tan pattern=2)
		legendlabel='National High Mid Year' name='high';
discretelegend 'percent' 'annual' 'low' 'high'/ border=false location=outside valign=bottom displayclipped=true valueattrs=(size=10pt) opaque=false;
drawimage "E:\Custom Reporting\2015 MOY Reporting\Appendix\Images for Appendix\graphbackground.jpg" / layer=back scale=fit border=false height=200 width=200 x=0 y=0;
endlayout;
endgraph;
end;
run;
DanH_sas
SAS Super FREQ

Without seeing the output, my guess is that the padding around the graph is causing this issue. On the BEGINGRAPH statement, try setting PAD=0 and see if the white goes away.

Amber1331
Calcite | Level 5

You have officially made my day! Thanks again. 

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
  • 8 replies
  • 1841 views
  • 0 likes
  • 2 in conversation