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

Hi @ChrisHemedinger , 

 

I'm having an issue with extra text in an email I'm sending. Here is my output:

Keegan_0-1633446255001.png

I've highlighted the text I'm trying to get rid of. I already have the titles in the charts themselves, and I'm also not sure why they are in the wrong positions, but I just want to remove them. 

 

Here is the code I'm using:

%macro email;

data _null_;
call symputx("today",put(today(),mmddyy10.));
run;

options EMAILSYS=SMTP EMAILID="keegan.xxxxx@xxxxx.com" EMAILHOST="GESVR5050.xxxxx.xxxxx.com";

FILENAME output EMAIL SUBJECT="Churn by Week as of &today." 
				       FROM="keegan.xxxxx@xxxxx.com" 
				         TO=("keegan.xxxxx@xxxxx.com")
					     BC=("keegan.xxxxx@xxxxx.com")
						type='text/html'
						CT ='text/html';


ods html5 (id=mail) body=OUTPUT options(bitmap_mode="inline")

style=htmlblue;
ods escapechar='^';
ODS TEXT="^S={font_face='Calibri' font_size=3 fontweight=Medium foreground=black} ";
ODS TEXT="^S={font_face='Calibri' font_size=3 fontweight=Medium foreground=black}Good morning,";
ODS TEXT="^S={font_face='Calibri' font_size=3 fontweight=Medium foreground=black} ";
ODS TEXT="^S={font_face='Calibri' font_size=3 fontweight=Medium foreground=black}See churn below and let me know if you have questions.";
ODS TEXT="^S={font_face='Calibri' font_size=3 fontweight=Medium foreground=black} ";
ODS TEXT="^S={font_face='Calibri' font_size=3 fontweight=Medium foreground=black}Thanks,";
ODS TEXT="^S={font_face='Calibri' font_size=3 fontweight=Medium foreground=black}Keegan";


ods graphics/ imagefmt=png width=1000px height=250px;
proc sgplot data=term_plot noautolegend; 
title 'Term Attrition';
	heatmapparm  y=prod_group x=week_starting1
	colorresponse=churn  / colormodel=(green yellow red) outline;
 text y=prod_group x=week_starting1 text=churn / textattrs=(size=11pt) ;
 
 yaxis label="Product Group";
 xaxis label="Week Beginning";
run;

proc sgrender data=attr_no_var 
              template=my_pie_chart;
run;

ods html5 (id=mail) close;

%mend;
%email;

I don't see why it's putting this text at the top. Do you have suggestions?

1 ACCEPTED SOLUTION

Accepted Solutions
ChrisHemedinger
Community Manager

TITLE (and FOOTNOTE) are global statements that affect all of your procedure output until you "clear" them by entering an empty statement:

 

title;
footnote;

So I'd advise adding these to the top of your program or at least before the ODS HTML5 statements. I see you placed a TITLE statement "inside" the PROC SGPLOT step, but since it's a global statement it's actually compiled and takes effect in the same way it would if you added it before the PROC. It's a style preference that many coders have though -- to place the global statements inside the procedure block they are intended to affect.

 

When you're "done" with that TITLE, clear it with an empty TITLE statement as shown above.

SAS For Dummies 3rd Edition! Check out the new edition, covering SAS 9.4, SAS Viya, and all of the modern ways to use SAS!

View solution in original post

5 REPLIES 5
ChrisHemedinger
Community Manager

Try adding gtitle to the ODS HTML5 statement. That will put the title inside the graph image instead of in the text.

SAS For Dummies 3rd Edition! Check out the new edition, covering SAS 9.4, SAS Viya, and all of the modern ways to use SAS!
ChrisHemedinger
Community Manager

And if you don't want the title in the image, add an empty TITLE; statement before the procedure (like your SGRENDER).

SAS For Dummies 3rd Edition! Check out the new edition, covering SAS 9.4, SAS Viya, and all of the modern ways to use SAS!
Keegan
Obsidian | Level 7

Hey Chris!

This seems to remove the other title, but then just adds the 'Term Attrition' in it's place:

Keegan_0-1633448847571.png

Here is the updated code:

ods html5 (id=mail) body=OUTPUT options(bitmap_mode="inline") gtitle

style=htmlblue;
ods escapechar='^';
ODS TEXT="^S={font_face='Calibri' font_size=3 fontweight=Medium foreground=black} ";
ODS TEXT="^S={font_face='Calibri' font_size=3 fontweight=Medium foreground=black}Good morning,";
ODS TEXT="^S={font_face='Calibri' font_size=3 fontweight=Medium foreground=black} ";
ODS TEXT="^S={font_face='Calibri' font_size=3 fontweight=Medium foreground=black}See churn below and let me know if you have questions.";
ODS TEXT="^S={font_face='Calibri' font_size=3 fontweight=Medium foreground=black} ";
ODS TEXT="^S={font_face='Calibri' font_size=3 fontweight=Medium foreground=black}Thanks,";
ODS TEXT="^S={font_face='Calibri' font_size=3 fontweight=Medium foreground=black}Keegan";


ods graphics/ imagefmt=png width=1000px height=250px;
proc sgplot data=term_plot noautolegend; 
title 'Term Attrition';
	heatmapparm  y=prod_group x=week_starting1
	colorresponse=churn  / colormodel=(green yellow red) outline;
 text y=prod_group x=week_starting1 text=churn / textattrs=(size=11pt) ;
 
 yaxis label="Product Group";
 xaxis label="Week Beginning";
run;

proc sgrender data=attr_no_var 
              template=my_pie_chart;
run;

ods html5 (id=mail) close;

%mend;
%email;

Also, I do want the titles within the image itself, just not outside of the image as stand alone text. 

ChrisHemedinger
Community Manager

TITLE (and FOOTNOTE) are global statements that affect all of your procedure output until you "clear" them by entering an empty statement:

 

title;
footnote;

So I'd advise adding these to the top of your program or at least before the ODS HTML5 statements. I see you placed a TITLE statement "inside" the PROC SGPLOT step, but since it's a global statement it's actually compiled and takes effect in the same way it would if you added it before the PROC. It's a style preference that many coders have though -- to place the global statements inside the procedure block they are intended to affect.

 

When you're "done" with that TITLE, clear it with an empty TITLE statement as shown above.

SAS For Dummies 3rd Edition! Check out the new edition, covering SAS 9.4, SAS Viya, and all of the modern ways to use SAS!
Keegan
Obsidian | Level 7

Thank you so much Chris! That worked!

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

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